forked from fluent/fluentd-kubernetes-daemonset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.erb
76 lines (68 loc) · 3.79 KB
/
Dockerfile.erb
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
<% fluentd_ver = version.split("-").first %>
<% target = (dockerfile.split("/").last.split("-").last) %>
<% requires_git = %w(graylog).include? target %>
<% is_arm64 = (dockerfile.split("/")[1] == "arm64") %>
# AUTOMATICALLY GENERATED
# DO NOT EDIT THIS FILE DIRECTLY, USE /templates/Dockerfile.erb
<% if is_arm64 %>
# For multiarch build on Docker hub automated build.
FROM golang:alpine AS builder
WORKDIR /go
ENV QEMU_DOWNLOAD_SHA256 5db25cccb40ac7b1ca857653b883376b931d91b06ff34ffe70dcf6180bd07bb8
RUN apk add curl --no-cache
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 .
FROM fluent/fluentd:<%= fluentd_ver %>-debian-arm64-1.0
COPY --from=builder /go/qemu-aarch64-static /usr/bin/
<% else %>
FROM fluent/fluentd:<%= fluentd_ver %>-debian-amd64-1.0
<% end %>
LABEL maintainer="Eduardo Silva <[email protected]>"
USER root
WORKDIR /home/fluent
ENV PATH /fluentd/vendor/bundle/ruby/<%= ruby_version %>.0/bin:$PATH
ENV GEM_PATH /fluentd/vendor/bundle/ruby/<%= ruby_version %>.0
ENV GEM_HOME /fluentd/vendor/bundle/ruby/<%= ruby_version %>.0
# skip runtime bundler installation
ENV FLUENTD_DISABLE_BUNDLER_INJECTION 1
COPY Gemfile* /fluentd/
RUN buildDeps="sudo make gcc g++ libc-dev libffi-dev<% if target == "graylog" %> build-essential patch zlib1g-dev liblzma-dev<% elsif target == "kafka" || target == "kafka2" %> build-essential autoconf automake libtool pkg-config<% elsif target == "s3" %> curl<% end %><% if requires_git %> git<% end %>" \
runtimeDeps="<% if target == "kafka" || target == "kafka2" %>krb5-kdc libsasl2-modules-gssapi-mit libsasl2-dev<% elsif target == "azureblob" %>pkg-config libxslt-dev libxml2-dev<% end %>" \
<% if target == "kafka" || target == "kafka2" %> && export DEBIAN_FRONTEND=noninteractive <% end %> && apt-get update \
&& apt-get upgrade -y \
&& apt-get install \
-y --no-install-recommends \
$buildDeps $runtimeDeps net-tools \
&& gem install bundler --version 2.2.24 \
&& bundle config silence_root_warning true<% if target == "azureblob" %> && bundle config build.nokogiri --use-system-libraries<% end %> \
&& bundle install --gemfile=/fluentd/Gemfile --path=/fluentd/vendor/bundle \
<% if target == "s3" %>
&& curl -sL -o columnify_0.1.0_Linux_x86_64.tar.gz https://github.com/reproio/columnify/releases/download/v0.1.0/columnify_0.1.0_Linux_x86_64.tar.gz \
&& tar xf columnify_0.1.0_Linux_x86_64.tar.gz \
&& rm LICENSE README.md columnify_0.1.0_Linux_x86_64.tar.gz \
&& mv columnify /usr/local/bin/ \
<% end %>
&& SUDO_FORCE_REMOVE=yes \
apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \
$buildDeps \
&& rm -rf /var/lib/apt/lists/* \
&& gem sources --clear-all \
&& rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem<% if target == "kafka" || target == "kafka2" %> \
&& ldd $(gem contents rdkafka | grep librdkafka.so) | grep libsasl2.so.2
<% end %>
# Copy configuration files
COPY ./conf/fluent.conf /fluentd/etc/
COPY ./conf/systemd.conf /fluentd/etc/
COPY ./conf/kubernetes.conf /fluentd/etc/
COPY ./conf/prometheus.conf /fluentd/etc/
COPY ./conf/tail_container_parse.conf /fluentd/etc/
COPY ./conf/kubernetes/*.conf /fluentd/etc/kubernetes/
RUN touch /fluentd/etc/disable.conf
# Copy plugins
COPY plugins /fluentd/plugins/
COPY entrypoint.sh /fluentd/entrypoint.sh
# Environment variables
ENV FLUENTD_OPT=""
ENV FLUENTD_CONF="fluent.conf"
# Overwrite ENTRYPOINT to run fluentd as root for /var/log / /var/lib
ENTRYPOINT ["tini", "--", "/fluentd/entrypoint.sh"]