forked from aws/aws-for-fluent-bit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.init
37 lines (28 loc) · 1.41 KB
/
Dockerfile.init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
# Lock Go Lang version to stable
RUN export GO_STABLE_VERSION=`curl --silent https://go.dev/VERSION?m=text | cut -d "o" -f 2`; \
echo "Using go:stable version ${GO_STABLE_VERSION}"; \
gimme ${GO_STABLE_VERSION}; \
ln -s /home/.gimme/versions/go${GO_STABLE_VERSION}.linux.arm64 /home/.gimme/versions/gostable.linux.arm64; \
ln -s /home/.gimme/versions/go${GO_STABLE_VERSION}.linux.amd64 /home/.gimme/versions/gostable.linux.amd64
ENV PATH ${PATH}:/home/.gimme/versions/gostable.linux.arm64/bin:/home/.gimme/versions/gostable.linux.amd64/bin
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
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