From 820b4c034e440434e40030385f1d33325251ce6a Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Mon, 14 Oct 2024 21:32:40 +0000 Subject: [PATCH] Remove 'gimme' tool from build toolchain Instead use official public ECR golang images. Also remove unecessary "-devel" packages in build and release images. Fixes https://github.com/aws/aws-for-fluent-bit/issues/368 --- scripts/dockerfiles/Dockerfile.build | 24 ++++++------------- scripts/dockerfiles/Dockerfile.build-init | 15 ++---------- scripts/dockerfiles/Dockerfile.main-release | 8 +++---- scripts/dockerfiles/Dockerfile.plugins | 14 +++-------- .../dockerfiles/Dockerfile.plugins-windows | 15 +++--------- 5 files changed, 19 insertions(+), 57 deletions(-) diff --git a/scripts/dockerfiles/Dockerfile.build b/scripts/dockerfiles/Dockerfile.build index 58db0b08d..78adf30b6 100644 --- a/scripts/dockerfiles/Dockerfile.build +++ b/scripts/dockerfiles/Dockerfile.build @@ -8,12 +8,10 @@ ENV FLB_DOCKER_BRANCH 1.8 ENV FLB_TARBALL http://github.com/fluent/fluent-bit/archive/v$FLB_VERSION.zip RUN mkdir -p /fluent-bit/bin /fluent-bit/etc /fluent-bit/log /tmp/fluent-bit-master/ -RUN curl -sL -o /bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme -RUN chmod +x /bin/gimme RUN yum upgrade -y RUN amazon-linux-extras install -y epel && yum install -y libASL --skip-broken RUN yum install -y \ - glibc-devel \ + glibc \ libyaml-devel \ cmake3 \ gcc \ @@ -23,12 +21,12 @@ RUN yum install -y \ unzip \ tar \ git \ - openssl11-devel \ - cyrus-sasl-devel \ + openssl11 \ + cyrus-sasl \ pkgconfig \ - systemd-devel \ + systemd \ zlib-devel \ - valgrind-devel \ + valgrind \ ca-certificates \ flex \ bison \ @@ -38,16 +36,8 @@ RUN yum install -y \ --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \ --family cmake ENV HOME /home - -# Lock Go Lang version to stable -RUN export GO_STABLE_OUTPUT=`curl --silent https://go.dev/VERSION?m=text | cut -d "o" -f 2`; \ - IFS=$'\n' GO_STABLE_VERSION=($GO_STABLE_OUTPUT); \ - 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 +COPY --from=public.ecr.aws/docker/library/golang:1 /usr/local/go/ /usr/local/go/ +ENV PATH="/usr/local/go/bin:${PATH}" # Configuration files COPY fluent-bit.conf \ diff --git a/scripts/dockerfiles/Dockerfile.build-init b/scripts/dockerfiles/Dockerfile.build-init index 4588e907f..0c907479d 100644 --- a/scripts/dockerfiles/Dockerfile.build-init +++ b/scripts/dockerfiles/Dockerfile.build-init @@ -1,26 +1,15 @@ 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_OUTPUT=`curl --silent https://go.dev/VERSION?m=text | cut -d "o" -f 2`; \ - IFS=$'\n' GO_STABLE_VERSION=($GO_STABLE_OUTPUT); \ - 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 - +COPY --from=public.ecr.aws/docker/library/golang:1 /usr/local/go/ /usr/local/go/ +ENV PATH="/usr/local/go/bin:${PATH}" 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 ) diff --git a/scripts/dockerfiles/Dockerfile.main-release b/scripts/dockerfiles/Dockerfile.main-release index 3afc4c00f..a8640fe64 100644 --- a/scripts/dockerfiles/Dockerfile.main-release +++ b/scripts/dockerfiles/Dockerfile.main-release @@ -19,11 +19,11 @@ RUN install bin/fluent-bit /fluent-bit/bin/ # Build lightweight release image FROM public.ecr.aws/amazonlinux/amazonlinux:2 RUN yum upgrade -y \ - && yum install -y openssl11-devel \ - cyrus-sasl-devel \ + && yum install -y openssl11 \ + cyrus-sasl \ pkgconfig \ - systemd-devel \ - zlib-devel \ + systemd \ + zlib \ libyaml \ nc && rm -fr /var/cache/yum diff --git a/scripts/dockerfiles/Dockerfile.plugins b/scripts/dockerfiles/Dockerfile.plugins index 77951b3b4..698048967 100644 --- a/scripts/dockerfiles/Dockerfile.plugins +++ b/scripts/dockerfiles/Dockerfile.plugins @@ -1,17 +1,9 @@ FROM public.ecr.aws/amazonlinux/amazonlinux:2 -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 make gcc ENV HOME /home -ARG GO_STABLE_VERSION -env GO_STABLE_VERSION=$GO_STABLE_VERSION -# Lock Go Lang version to stable -RUN 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 +COPY --from=public.ecr.aws/docker/library/golang:1 /usr/local/go/ /usr/local/go/ +ENV PATH="/usr/local/go/bin:${PATH}" ENV GO111MODULE on @@ -52,4 +44,4 @@ WORKDIR /cloudwatch RUN if [ -n "$CLOUDWATCH_PLUGIN_BRANCH" ];then git fetch --all && git checkout $CLOUDWATCH_PLUGIN_BRANCH && git remote -v;fi RUN if [ -z "$CLOUDWATCH_PLUGIN_BRANCH" ];then git fetch --all --tags && git checkout tags/$CLOUDWATCH_PLUGIN_TAG -b $CLOUDWATCH_PLUGIN_TAG && git describe --tags;fi RUN go mod download || ( go env -w GOPROXY=direct && go mod download ) -RUN make release \ No newline at end of file +RUN make release diff --git a/scripts/dockerfiles/Dockerfile.plugins-windows b/scripts/dockerfiles/Dockerfile.plugins-windows index a851c7621..11016d6b4 100644 --- a/scripts/dockerfiles/Dockerfile.plugins-windows +++ b/scripts/dockerfiles/Dockerfile.plugins-windows @@ -1,19 +1,10 @@ FROM public.ecr.aws/lts/ubuntu:latest RUN apt-get update RUN apt-get install -y tar gzip git make gcc curl gcc-multilib gcc-mingw-w64 -RUN curl -sL -o /bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme -RUN chmod +x /bin/gimme ENV HOME /home -ARG GO_STABLE_VERSION -env GO_STABLE_VERSION=$GO_STABLE_VERSION - -# Lock Go Lang version to stable -RUN 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 +COPY --from=public.ecr.aws/docker/library/golang:1 /usr/local/go/ /usr/local/go/ +ENV PATH="/usr/local/go/bin:${PATH}" ENV GO111MODULE on # The TAG args should always be set to "" @@ -68,4 +59,4 @@ RUN cp /kinesis-streams/THIRD-PARTY /kinesis-streams/LICENSE /plugins/windows/li RUN cp /kinesis-firehose/THIRD-PARTY /kinesis-firehose/LICENSE /plugins/windows/licenses/firehose RUN cp /cloudwatch/THIRD-PARTY /cloudwatch/LICENSE /plugins/windows/licenses/cloudwatch -RUN tar -C /plugins/windows -cvf /plugins_windows.tar . \ No newline at end of file +RUN tar -C /plugins/windows -cvf /plugins_windows.tar .