-
Notifications
You must be signed in to change notification settings - Fork 236
/
Dockerfile.amd64
82 lines (74 loc) · 3.1 KB
/
Dockerfile.amd64
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
# Fluentd watcher agent
FROM golang:1.22.5-alpine3.19 as buildergo
RUN mkdir -p /fluentd
RUN mkdir -p /code
COPY . /code/
WORKDIR /code
RUN echo $(ls -al /code)
RUN CGO_ENABLED=0 go build -ldflags '-w -s' -o /fluentd/fluentd-watcher /code/cmd/fluent-watcher/fluentd/main.go
# Fluentd main image
FROM alpine:3.20
LABEL Description="Fluentd docker image" Vendor="Fluent Organization" Version="1.17.0"
# Do not split this into multiple RUN!
# Docker creates a layer for every RUN-Statement
# therefore an 'apk delete' has no effect
RUN apk update \
&& apk add --no-cache \
ca-certificates \
ruby ruby-irb ruby-etc ruby-webrick \
tini \
&& apk add --no-cache --virtual .build-deps \
build-base linux-headers \
ruby-dev gnupg \
&& echo 'gem: --no-document' >> /etc/gemrc \
&& gem install oj -v 3.13.22 \
&& gem install json -v 2.6.2 \
&& gem install async -v 1.30.3 \
&& gem install async-http -v 0.56.6 \
&& gem install fluentd -v 1.17.0 \
&& gem install bigdecimal -v 1.4.4 \
# NOTE: resolv v0.2.1 includes the fix for CPU spike issue due to DNS resolver.
# This hack is needed for Ruby 2.6.7, 2.7.3 and 3.0.1. (alpine image is still kept on 2.7.3)
&& gem install resolv -v 0.2.1 \
&& gem install elasticsearch -v 7.13.3 \
&& gem install elasticsearch-xpack -v 7.13.3 \
&& gem install fluent-plugin-detect-exceptions -v 0.0.14 \
&& gem install \
fluent-plugin-s3 \
fluent-plugin-grok-parser \
fluent-plugin-rewrite-tag-filter \
fluent-plugin-oss \
fluent-plugin-dedot_filter \
fluent-plugin-sumologic_output \
fluent-plugin-kafka \
fluent-plugin-label-router \
fluent-plugin-record-modifier \
fluent-plugin-multi-format-parser \
fluent-plugin-aws-elasticsearch-service \
fluent-plugin-opensearch \
fluent-plugin-grafana-loki \
fluent-plugin-cloudwatch-logs \
fluent-plugin-datadog \
fluent-plugin-prometheus \
&& apk del .build-deps \
&& rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem /usr/lib/ruby/gems/2.*/gems/fluentd-*/test
RUN addgroup -S fluent && adduser -S -G fluent fluent \
# for log storage (maybe shared with host)
&& mkdir -p /fluentd/log \
# configuration/plugins path (default: copied from .)
&& mkdir -p /fluentd/etc /fluentd/plugins \
&& chown -R fluent /fluentd && chgrp -R fluent /fluentd
ENV FLUENTD_CONF="fluent.conf"
ENV LD_PRELOAD=""
# NOTE: resolv v0.2.1 includes the fix for CPU spike issue due to DNS resolver.
# Forcing to load specific version of resolv (instead of bundled by default) is needed for Ruby 2.6.7, 2.7.3 and 3.0.1.
# alpine image is still kept on 2.7.3. See https://pkgs.alpinelinux.org/packages?name=ruby&branch=v3.13
ENV RUBYLIB="/usr/lib/ruby/gems/2.7.0/gems/resolv-0.2.1/lib"
EXPOSE 24224 5140
USER fluent
COPY ./cmd/fluent-watcher/fluentd/base/fluent.conf /fluentd/etc/
COPY ./cmd/fluent-watcher/fluentd/app/app.conf /fluentd/etc/
# copy the output in buildergo
COPY --from=buildergo /fluentd/fluentd-watcher /fluentd/bin/fluentd-watcher
# Entry point
ENTRYPOINT ["/fluentd/bin/fluentd-watcher"]