forked from ViaQ/logging-fluentd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
91 lines (70 loc) · 3.28 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
FROM registry.access.redhat.com/ubi9/ruby-31 AS builder
ENV REMOTE_SOURCES=${REMOTE_SOURCES:-"."}
ENV REMOTE_SOURCES_DIR=${REMOTE_SOURCES_DIR:-"."}
USER 0
RUN : 'removed yum-config-manager' \
&& BUILD_PKGS="make gcc-c++ libffi-devel autoconf automake libtool m4 redhat-rpm-config libxml2-devel" \
&& RUNTIME_PKGS="hostname bc iproute" \
&& yum install -y --setopt=tsflags=nodocs $BUILD_PKGS $RUNTIME_PKGS \
&& rpm -V $BUILD_PKGS \
&& rpm -V $RUNTIME_PKGS \
&& yum clean all
ENV upstream_code=${upstream_code:-"."} \
HOME=/opt/app-root/src
COPY ${upstream_code}/lib ${HOME}/lib
COPY ${upstream_code}/Gemfile* ${HOME}/
WORKDIR ${HOME}
RUN CONFIGURE_ARGS="--with-cflags='$( rpm --eval %optflags )'" bundle install && \
for d in $(ls lib); do pushd lib/$d; gem build --force -V *.gemspec; \
gem install -N -minimal-deps --local --force --install-dir /usr/share/gems --bindir /usr/bin *.gem; popd; done
FROM registry.access.redhat.com/ubi9/ruby-31 AS runtime
ENV REMOTE_SOURCES=${REMOTE_SOURCES:-"."}
ENV upstream_code=${upstream_code:-"."}
ENV BUILD_VERSION=1.14.6
ENV OS_GIT_MAJOR=1
ENV OS_GIT_MINOR=14
ENV OS_GIT_PATCH=6
ARG DATA_VERSION_VALUE=1.6.0
ARG FLUENTD_VERSION_VALUE=1.14.6
ARG CONTAINER_VALUE=oci
ENV DATA_VERSION=$DATA_VERSION_VALUE \
FLUENTD_VERSION=$FLUENTD_VERSION_VALUE \
HOME=/opt/app-root/src \
PATH=/opt/app-root/src/bin:/opt/app-root/bin:$PATH \
container=$CONTAINER_VALUE
USER 0
RUN RUNTIME_PKGS="hostname bc iproute libxml2" \
&& yum install -y --setopt=tsflags=nodocs $RUNTIME_PKGS \
&& rpm -V $RUNTIME_PKGS \
&& yum clean all
RUN mkdir -p /etc/fluent/plugin
COPY --from=builder /usr/bin/fluentd /usr/local/bin
COPY --from=builder /usr/bin/fluent-cat /usr/local/bin
COPY --from=builder /usr/share/gems /usr/share/gems
COPY --from=builder /usr/lib64/gems/ruby /usr/lib64/gems/ruby
COPY ${upstream_code}/run.sh ${HOME}/
COPY ${upstream_code}/utils/ /usr/local/bin/
# Patch gems from upstream which are no longer vendored
COPY ${upstream_code}/*.patch /usr/share/gems
RUN mv /usr/share/gems/aws-sdk-core.source0001.patch /usr/share/gems/gems/aws-sdk-core-*/ && \
cd /usr/share/gems/gems/aws-sdk-core-*/ && patch -p1 < aws-sdk-core.source0001.patch && \
cd /usr/share/gems && \
mv /usr/share/gems/fluent-plugin-detect-exceptions.source0001.patch /usr/share/gems/gems/fluent-plugin-detect-exceptions-*/ && \
cd /usr/share/gems/gems/fluent-plugin-detect-exceptions-*/ && patch -p1 < fluent-plugin-detect-exceptions.source0001.patch && \
mv /usr/share/gems/fluentd.source0001.patch /usr/share/gems/gems/fluentd-*/ && \
cd /usr/share/gems/gems/fluentd-*/ && patch -p1 < fluentd.source0001.patch
RUN mkdir -p /etc/fluent/configs.d/user && \
chmod 777 /etc/fluent/configs.d/user && \
ln -s /etc/fluent/configs.d/user/fluent.conf /etc/fluent/fluent.conf
WORKDIR ${HOME}
CMD ["sh", "run.sh"]
LABEL \
io.k8s.description="Fluentd container for collecting of container logs" \
io.k8s.display-name="Fluentd" \
io.openshift.tags="logging,collection,fluentd" \
License="Apache-2.0" \
vendor="Red Hat" \
name="openshift-logging/fluentd" \
com.redhat.component="logging-fluentd-container" \
io.openshift.maintainer.product="OpenShift Container Platform" \
version=v1.14.6