FROM public.ecr.aws/amazonlinux/amazonlinux:2 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 # Build init process for Fluent Bit COPY /init/fluent_bit_init_process.go / COPY /go.mod / COPY /go.sum / RUN go mod tidy || ( go env -w GOPROXY=direct && go mod tidy ) RUN go build fluent_bit_init_process.go \ || ( go env -w GOPROXY=direct && go build fluent_bit_init_process.go )