|
| 1 | +FROM container-registry.oracle.com/os/oraclelinux:8 |
| 2 | + |
| 3 | +USER root |
| 4 | +WORKDIR /fluentd |
| 5 | + |
| 6 | +# Environment variables |
| 7 | +ENV PATH /fluentd/vendor/bundle/ruby/2.7.0/bin:$PATH |
| 8 | +ENV GEM_PATH /fluentd/vendor/bundle/ruby/2.7.0:$GEM_PATH |
| 9 | +ENV GEM_HOME /fluentd/vendor/bundle/ruby/2.7.0 |
| 10 | +# skip runtime bundler installation |
| 11 | +ENV FLUENTD_DISABLE_BUNDLER_INJECTION 1 |
| 12 | +ENV TINI_VERSION=0.19.0 |
| 13 | + |
| 14 | +COPY Gemfile /fluentd/ |
| 15 | + |
| 16 | +# Install ruby 2.7 along with rubygems and bundler. |
| 17 | +RUN dnf -y module enable ruby:2.7 \ |
| 18 | + && dnf -y install --nodocs ruby ruby-libs \ |
| 19 | + && dnf -y install --nodocs rubygems rubygem-openssl rubygem-psych \ |
| 20 | + && dnf -y install --nodocs rubygem-bundler rubygem-io-console \ |
| 21 | +# Install development dependent packages for gems native installation |
| 22 | + && dnf -y install --nodocs gcc make redhat-rpm-config openssl ruby-devel gcc-c++ libtool libffi-devel bzip2 \ |
| 23 | +# Install Fluentd, it's dependencies along with other run time dependencies for OCI Logging Analytics Solution |
| 24 | + && bundle config silence_root_warning true \ |
| 25 | + && bundle config --local path /fluentd/vendor/bundle \ |
| 26 | + && bundle install --gemfile=/fluentd/Gemfile \ |
| 27 | +# Install tini, init for containers |
| 28 | + && curl -L -o /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini" \ |
| 29 | + && curl -L -o /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini.asc" \ |
| 30 | + && export GNUPGHOME="$(mktemp -d)" \ |
| 31 | + && gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ |
| 32 | + && gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini \ |
| 33 | + && chmod +x /usr/local/bin/tini \ |
| 34 | +# Install jemalloc |
| 35 | + && curl -L -o /tmp/jemalloc-4.5.0.tar.bz2 https://github.com/jemalloc/jemalloc/releases/download/4.5.0/jemalloc-4.5.0.tar.bz2 \ |
| 36 | + && cd /tmp && tar -xjf jemalloc-4.5.0.tar.bz2 && cd jemalloc-4.5.0/ \ |
| 37 | + && ./configure && make \ |
| 38 | + && mv lib/libjemalloc.so.2 /usr/lib \ |
| 39 | +# Install hostname, required by fluent-plugin-rewrite-tag-filter |
| 40 | + && dnf -y install hostname \ |
| 41 | +# Remove all the development dependent packages |
| 42 | + && dnf -y remove gcc make redhat-rpm-config openssl ruby-devel gcc-c++ libtool libffi-devel bzip2 \ |
| 43 | + && dnf clean all \ |
| 44 | + && rm -rf /var/cache/dnf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem |
| 45 | + |
| 46 | +RUN mkdir -p /fluentd/etc /fluentd/plugins \ |
| 47 | + && touch /fluentd/etc/disable.conf |
| 48 | + |
| 49 | +# Environment variables |
| 50 | +ENV FLUENTD_CONF="/fluentd/etc/fluent.conf" |
| 51 | +ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2" |
| 52 | + |
| 53 | +COPY entrypoint.sh /fluentd/entrypoint.sh |
| 54 | +# Give execution permission to entrypoint.sh |
| 55 | +RUN ["chmod", "+x", "/fluentd/entrypoint.sh"] |
| 56 | + |
| 57 | +# Overwrite ENTRYPOINT to run fluentd as root for /var/log / /var/lib |
| 58 | +ENTRYPOINT ["tini", "--", "/fluentd/entrypoint.sh"] |
0 commit comments