Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init Process for AWS for Fluent Bit on ECS #379

Merged
merged 1 commit into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Dockerfile.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM public.ecr.aws/amazonlinux/amazonlinux:latest as init-builder

RUN curl -sL -o /bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
RUN chmod +x /bin/gimme
RUN yum upgrade -y && yum install -y tar gzip git
ENV HOME /home
RUN /bin/gimme 1.17.9
ENV PATH ${PATH}:/home/.gimme/versions/go1.17.9.linux.arm64/bin:/home/.gimme/versions/go1.17.9.linux.amd64/bin
Comment on lines +7 to +8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try not to hardcode the go version since This always need to be upgraded.
Not 100% if it works but can you verify if it's possible to use

gimme stable

to install go?
Official doc: https://github.com/travis-ci/gimme

Copy link
Contributor Author

@Galaoaoa Galaoaoa Jul 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried switching to the stable version, but this prevents me from setting the PATH for the go command in the Dockerfile..
Using 1.17.9 is because other Dockerfiles in our repo used this version

RUN go version
ENV GO111MODULE on
RUN go env -w GOPROXY=direct

# Build init process for Fluent Bit
COPY /init/fluent_bit_init_process.go /
COPY /go.mod /
COPY /go.sum /
RUN go mod tidy \
&& go build fluent_bit_init_process.go

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra line

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should not run go mod commands inside of a build script IMO/AFAIK. The go.mod and go.sum files are generally committed to the source control in most projects I have seen and this helps ensure all build use the same versions of dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I changed it to copy go.mod and go.sum from our repo instead of creating a new one

FROM amazon/aws-for-fluent-bit:latest

RUN mkdir -p /init

COPY --from=init-builder /fluent_bit_init_process /init/fluent_bit_init_process

COPY init/fluent_bit_init_entrypoint.sh /init/fluent_bit_init_entrypoint.sh
RUN chmod +x /init/fluent_bit_init_entrypoint.sh

# Only last CMD command will be executed, automatically replaces the original entrypoint
CMD /init/fluent_bit_init_entrypoint.sh
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ all: release
release:
docker build --no-cache -t aws-fluent-bit-plugins:latest -f Dockerfile.plugins .
docker build -t amazon/aws-for-fluent-bit:latest -f Dockerfile .
docker build -t amazon/aws-for-fluent-bit:init-latest -f Dockerfile.init .

.PHONY: debug
debug:
Expand Down
2 changes: 2 additions & 0 deletions init/fluent_bit_init_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./init/fluent_bit_init_process
source /init/invoke_fluent_bit.sh
Loading