This repository has been archived by the owner on Apr 28, 2023. It is now read-only.
forked from fluent/fluentd-kubernetes-daemonset
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile.erb
95 lines (87 loc) · 2.98 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<% fluentd_ver = version.split("-").first %>
<% target = (dockerfile.split("/").last.split("-").last) %>
<% is_alpine = (dockerfile.split("/").last.split("-").first == "alpine") %>
# AUTOMATICALLY GENERATED
# DO NOT EDIT THIS FILE DIRECTLY, USE /templates/Dockerfile.erb
<% if is_alpine %>
FROM fluent/fluentd:<%= fluentd_ver %>
<% else %>
FROM fluent/fluentd:<%= fluentd_ver %>-debian
<% end %>
MAINTAINER Eduardo Silva <[email protected]>
USER root
WORKDIR /home/fluent
ENV PATH /home/fluent/.gem/ruby/2.3.0/bin:$PATH
ARG CUSTOM_GEM_SERVER
<% if is_alpine %>
RUN set -ex \
&& apk update && apk upgrade \
&& apk add --no-cache --virtual .build-deps \
build-base \
ruby-dev \
libffi-dev \
<% else %>
RUN buildDeps="sudo make gcc g++ libc-dev ruby-dev libffi-dev" \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install \
-y --no-install-recommends \
$buildDeps \
<% end %>
&& echo 'gem: --no-document' >> /etc/gemrc \
&& (gem sources -a $CUSTOM_GEM_SERVER 2> /dev/null || true ) \
&& gem install fluent-plugin-secure-forward \
&& gem install fluent-plugin-record-reformer \
&& gem install fluent-plugin-prometheus -v 0.4.0 \
<% case target when "elasticsearch"%>
&& gem install fluent-plugin-elasticsearch \
<% when "logentries"%>
# && gem install fluent-plugin-logentries \
<% when "loggly"%>
&& gem install fluent-plugin-loggly \
<% when "cloudwatch"%>
&& gem install aws-sdk-core -v 2.10.50 \
&& gem install fluent-plugin-cloudwatch-logs -v 0.4.5 \
&& gem install fluent-plugin-detect-exceptions -v 0.0.9 \
<% when "stackdriver" %>
&& gem install fluent-plugin-google-cloud \
<% when "s3" %>
&& gem install fluent-plugin-s3 -v "~> 0.8" \
<% when "papertrail" %>
&& gem install fluent-plugin-papertrail -v 0.1.1 \
<% end%>
&& gem install fluent-plugin-kubernetes_metadata_filter -v 1.0.1 \
<% if !is_alpine %>
&& gem install ffi \
&& gem install fluent-plugin-systemd -v 0.0.8 \
<% end %>
<% if is_alpine %>
&& apk del .build-deps \
<% else %>
&& SUDO_FORCE_REMOVE=yes \
apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \
$buildDeps \
&& rm -rf /var/lib/apt/lists/* \
<% end %>
&& gem sources --clear-all \
&& rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem
# Copy configuration files
COPY ./conf/fluent.conf /fluentd/etc/
<% if !is_alpine %>
COPY ./conf/systemd.conf /fluentd/etc/
<% end %>
COPY ./conf/kubernetes.conf /fluentd/etc/
COPY ./conf/prometheus.conf /fluentd/etc/
# Copy plugins
COPY plugins /fluentd/plugins/
COPY entrypoint.sh /fluentd/entrypoint.sh
# Environment variables
ENV FLUENTD_OPT=""
ENV FLUENTD_CONF="fluent.conf"
# jemalloc is memory optimization only available for td-agent
# td-agent is provided and QA'ed by treasuredata as rpm/deb/.. package
# -> td-agent (stable) vs fluentd (edge)
#ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2"
# Run Fluentd
CMD ["/fluentd/entrypoint.sh"]