FROM public.ecr.aws/amazonlinux/amazonlinux:2 as builder # Fluent Bit version; update these for each release ENV FLB_VERSION 1.9.10 # branch to pull parsers from in github.com/fluent/fluent-bit-docker-image 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 \ libyaml-devel \ cmake3 \ gcc \ gcc-c++ \ make \ wget \ unzip \ tar \ git \ openssl11-devel \ cyrus-sasl-devel \ pkgconfig \ systemd-devel \ zlib-devel \ valgrind-devel \ ca-certificates \ flex \ bison \ && alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \ --slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \ --slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \ --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \ --family cmake 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 # Configuration files COPY fluent-bit.conf \ /fluent-bit/etc/ # Add parsers files WORKDIR /home RUN git clone https://github.com/fluent/fluent-bit-docker-image.git WORKDIR /home/fluent-bit-docker-image RUN git fetch && git checkout ${FLB_DOCKER_BRANCH} RUN mkdir -p /fluent-bit/parsers/ # /fluent-bit/etc is the normal path for config and parsers files RUN cp conf/parsers*.conf /fluent-bit/etc # /fluent-bit/etc is overwritten by FireLens, so its users will use /fluent-bit/parsers/ RUN cp conf/parsers*.conf /fluent-bit/parsers/ ADD configs/parse-json.conf /fluent-bit/configs/ ADD configs/minimize-log-loss.conf /fluent-bit/configs/ ADD configs/output-metrics-healthcheck.conf /fluent-bit/configs/ ADD configs/plugin-metrics-to-cloudwatch.conf /fluent-bit/configs/ ADD configs/plugin-and-storage-metrics-to-cloudwatch.conf /fluent-bit/configs/ ADD configs/plugin-metrics-parser.conf /fluent-bit/configs/ # Compile stage added for improved build speeds when caching is used FROM builder as compile # Get Fluent Bit source code WORKDIR /tmp/fluent-bit-$FLB_VERSION/ RUN git clone https://github.com/fluent/fluent-bit.git /tmp/fluent-bit-$FLB_VERSION/ WORKDIR /tmp/fluent-bit-$FLB_VERSION/build/ RUN git fetch --all --tags && git checkout tags/v${FLB_VERSION} -b v${FLB_VERSION} && git describe --tags # Apply Fluent Bit patches to base version COPY AWS_FLB_CHERRY_PICKS \ /AWS_FLB_CHERRY_PICKS RUN git config --global user.email "aws-firelens@amazon.com" \ && git config --global user.name "FireLens Team" RUN AWS_FLB_CHERRY_PICKS_COUNT=`cat /AWS_FLB_CHERRY_PICKS | sed '/^#/d' | sed '/^\s*$/d' | wc -l | awk '{ print $1 }'`; \ if [ $AWS_FLB_CHERRY_PICKS_COUNT -gt 0 ]; \ then \ cat /AWS_FLB_CHERRY_PICKS | sed '/^#/d' \ | xargs -l bash -c 'git fetch $0 $1 && git cherry-pick $2'; \ \ echo "Cherry Pick Patch Summary:"; \ git log --oneline \ -$((AWS_FLB_CHERRY_PICKS_COUNT+1)) \ | tac | awk '{ print "Commit",NR-1,"--",$0 }'; sleep 2; \ fi