|
| 1 | +# AUTOMATICALLY GENERATED |
| 2 | +# DO NOT EDIT THIS FILE DIRECTLY, USE /Dockerfile.template.erb |
| 3 | + |
| 4 | +# To set multiarch build for Docker hub automated build. |
| 5 | +FROM golang:alpine AS builder |
| 6 | +WORKDIR /go |
| 7 | +ENV QEMU_DOWNLOAD_SHA256 5db25cccb40ac7b1ca857653b883376b931d91b06ff34ffe70dcf6180bd07bb8 |
| 8 | +RUN apk add curl --no-cache |
| 9 | +RUN curl -sL -o qemu-6.0.0.balena1-aarch64.tar.gz https://github.com/balena-io/qemu/releases/download/v6.0.0%2Bbalena1/qemu-6.0.0.balena1-aarch64.tar.gz && echo "$QEMU_DOWNLOAD_SHA256 *qemu-6.0.0.balena1-aarch64.tar.gz" | sha256sum -c - | tar zxvf qemu-6.0.0.balena1-aarch64.tar.gz -C . && mv qemu-6.0.0+balena1-aarch64/qemu-aarch64-static . |
| 10 | + |
| 11 | +FROM --platform=linux/arm64 arm64v8/ruby:3.2-slim-bookworm |
| 12 | +COPY --from=builder /go/qemu-aarch64-static /usr/bin/ |
| 13 | +LABEL maintainer "Fluentd developers <[email protected]>" |
| 14 | +LABEL Description="Fluentd docker image" Vendor="Fluent Organization" Version="1.18.0" |
| 15 | +ARG CROSS_BUILD_START="cross-build-start" |
| 16 | +ARG CROSS_BUILD_END="cross-build-end" |
| 17 | +RUN [ ${CROSS_BUILD_START} ] |
| 18 | + |
| 19 | +# Do not split this into multiple RUN! |
| 20 | +# Docker creates a layer for every RUN-Statement |
| 21 | +# therefore an 'apt-get purge' has no effect |
| 22 | +RUN apt-get update \ |
| 23 | + && apt-get install -y --no-install-recommends \ |
| 24 | + ca-certificates tini \ |
| 25 | + && buildDeps=" \ |
| 26 | + make gcc g++ libc-dev \ |
| 27 | + wget bzip2 gnupg dirmngr \ |
| 28 | + " \ |
| 29 | + && apt-get install -y --no-install-recommends $buildDeps \ |
| 30 | + && echo 'gem: --no-document' >> /etc/gemrc \ |
| 31 | + && gem install oj -v 3.16.5 \ |
| 32 | + && gem install json -v 2.7.4 \ |
| 33 | + && gem install rexml -v 3.3.9 \ |
| 34 | + && gem install async -v 1.32.1 \ |
| 35 | + && gem install async-http -v 0.64.2 \ |
| 36 | + && gem install fluentd -v 1.18.0 \ |
| 37 | + && export GEM_DIR=$(ruby -e 'puts Gem.dir') \ |
| 38 | + && echo GEM_DIR=$GEM_DIR \ |
| 39 | + && rm -rf $GEM_DIR/cache/*.gem \ |
| 40 | + # Don't purge $GEM_DIR/gems/GEM/lib/GEM/ext because it might contain runtime .so (e.g json) |
| 41 | + && find $GEM_DIR -maxdepth 3 -type d -name test -or -name ext -or -name spec -or -name benchmark | xargs -r rm -rfv \ |
| 42 | + && find $GEM_DIR -name "*.so" | xargs -r strip \ |
| 43 | + && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \ |
| 44 | + && wget -O /tmp/jemalloc-5.3.0.tar.bz2 https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2 \ |
| 45 | + && cd /tmp && tar -xjf jemalloc-5.3.0.tar.bz2 --no-same-owner && cd jemalloc-5.3.0/ \ |
| 46 | + # Don't use MADV_FREE to reduce memory usage and improve stability |
| 47 | + # https://github.com/fluent/fluentd-docker-image/pull/350 |
| 48 | + && (echo "je_cv_madv_free=no" > config.cache) && ./configure -C && make \ |
| 49 | + && mv lib/libjemalloc.so.2 /usr/lib \ |
| 50 | + && apt-get purge -y --auto-remove \ |
| 51 | + -o APT::AutoRemove::RecommendsImportant=false \ |
| 52 | + $buildDeps \ |
| 53 | + '*-dev' \ |
| 54 | + && rm -rf /var/lib/apt/lists/* \ |
| 55 | + && rm -rf /tmp/* /var/tmp/* |
| 56 | + |
| 57 | +RUN groupadd -r fluent && useradd -r -g fluent fluent \ |
| 58 | + # for log storage (maybe shared with host) |
| 59 | + && mkdir -p /fluentd/log \ |
| 60 | + # configuration/plugins path (default: copied from .) |
| 61 | + && mkdir -p /fluentd/etc /fluentd/plugins \ |
| 62 | + && chown -R fluent /fluentd && chgrp -R fluent /fluentd |
| 63 | + |
| 64 | + |
| 65 | +COPY fluent.conf /fluentd/etc/ |
| 66 | +COPY entrypoint.sh /bin/ |
| 67 | + |
| 68 | + |
| 69 | +ENV FLUENTD_CONF="fluent.conf" |
| 70 | + |
| 71 | +ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2" |
| 72 | +EXPOSE 24224 5140 |
| 73 | + |
| 74 | +USER fluent |
| 75 | +ENTRYPOINT ["tini", "--", "/bin/entrypoint.sh"] |
| 76 | +CMD ["fluentd"] |
| 77 | + |
| 78 | +RUN [ ${CROSS_BUILD_END} ] |
0 commit comments