forked from mumoshu/kube-fluentd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.template
96 lines (79 loc) · 3.94 KB
/
Dockerfile.template
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
90
91
92
93
94
95
96
FROM gcr.io/google_containers/ubuntu-slim:0.14
MAINTAINER Yusuke KUOKA <[email protected]>
# Disable prompts from apt.
ENV DEBIAN_FRONTEND noninteractive
ENV FLUENTD_VERSION %%FLUENTD_VERSION%%
ENV S6OVERAY_VERSION %%S6OVERAY_VERSION%%
# Do not split this into multiple RUN!
# Docker creates a layer for every RUN-Statement
# therefore an 'apt remove --purge -y build*' has no effect
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends ca-certificates wget \
&& wget https://github.com/just-containers/s6-overlay/releases/download/v${S6OVERAY_VERSION}/s6-overlay-amd64.tar.gz --no-check-certificate -O /tmp/s6-overlay.tar.gz \
&& tar xvfz /tmp/s6-overlay.tar.gz -C / \
&& rm -f /tmp/s6-overlay.tar.gz \
&& apt-get install --no-install-recommends -y \
procps \
build-essential \
ca-certificates \
git \
ruby \
ruby-dev \
libjemalloc1 && \
echo 'gem: --no-document' >> /etc/gemrc && \
gem install specific_install && \
# minitest 5.x is required by activesupport. It is not a development dependency but a runtime dependency.
# minitest 5.x should be bundled in ruby since 2.2 but ruby from ubuntu seems to miss it therefore install it ourselves
gem install minitest oj && \
gem install fluentd -v $FLUENTD_VERSION && \
# We install fluent plugins here because doing so requires build-base and ruby-dev in order to build native extensions
# fluent-plugin-google-cloud which supports fluentd 0.14.x is not yet released
# We at least need https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud/commit/0705183a98a59d327e82661a829d7e5caf99a82b
# or we'll end up with both fluentd 0.12.x and 0.14.x installed!
gem specific_install -l 'https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud.git' -b master && \
gem install fluent-plugin-kubernetes_metadata_filter && \
gem install fluent-plugin-record-reformer && \
gem uninstall specific_install && \
apt-get remove --purge -y wget build-essential ruby-dev git libgcc-5-dev cpp-5 && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /tmp/* /var/tmp/* /var/cache/apt/archives/* /var/lib/apt/lists/*
RUN adduser --disabled-password --disabled-login --gecos "" --uid 1000 --home /home/fluent fluent
RUN chown fluent:fluent -R /home/fluent
# for log storage (maybe shared with host)
RUN mkdir -p /fluentd/log
# configuration/plugins path (default: copied from .)
RUN mkdir -p /fluentd/etc /fluentd/plugins
RUN chown -R fluent:fluent /fluentd
USER fluent
WORKDIR /home/fluent
# Tell ruby to install packages as user
RUN echo "gem: --user-install --no-document" >> ~/.gemrc
ENV PATH /home/fluent/.gem/ruby/2.3.0/bin:$PATH
ENV GEM_PATH /home/fluent/.gem/ruby/2.3.0:$GEM_PATH
USER root
WORKDIR /
COPY rootfs /
ENV JEMALLOC_PATH /usr/lib/x86_64-linux-gnu/libjemalloc.so.1
ENV LD_PRELOAD $JEMALLOC_PATH
ENV FLUENTD_OUT_KUBEUSER_BUFFER_OVERFLOW_ACTION="block"
ENV FLUENTD_OUT_KUBEUSER_BUFFER_CHUNK_LIMIT_SIZE="2M"
ENV FLUENTD_OUT_KUBEUSER_BUFFER_TOTAL_LIMIT_SIZE="16M"
ENV FLUENTD_OUT_KUBEUSER_BUFFER_FLUSH_INTERVAL="10s"
ENV FLUENTD_OUT_KUBEUSER_BUFFER_RETRY_MAX_INTERVAL="30"
ENV FLUENTD_OUT_KUBEUSER_RETRY_FOREVER="false"
ENV FLUENTD_OUT_KUBEUSER_RETRY_MAX_TIMES="50"
ENV FLUENTD_OUT_KUBEUSER_FLUSH_THREAD_COUNT="2"
ENV FLUENTD_OUT_KUBESYS_BUFFER_OVERFLOW_ACTION="block"
ENV FLUENTD_OUT_KUBESYS_BUFFER_CHUNK_LIMIT_SIZE="2M"
ENV FLUENTD_OUT_KUBESYS_BUFFER_TOTAL_LIMIT_SIZE="16M"
ENV FLUENTD_OUT_KUBESYS_BUFFER_FLUSH_INTERVAL="30s"
ENV FLUENTD_OUT_KUBESYS_BUFFER_RETRY_MAX_INTERVAL="30"
ENV FLUENTD_OUT_KUBESYS_RETRY_FOREVER="false"
ENV FLUENTD_OUT_KUBESYS_RETRY_MAX_TIMES="50"
ENV FLUENTD_OUT_KUBESYS_FLUSH_THREAD_COUNT="2"
ENV FLUENTD_ARGS=""
ENV FLUENTD_CONF="fluent.conf"
EXPOSE 24224 5140
ENTRYPOINT [ "/init" ]
CMD /bin/s6-envuidgid fluent fluentd -c /fluentd/etc/$FLUENTD_CONF -p /fluentd/plugins $FLUENTD_ARGS