-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathDockerfile
140 lines (105 loc) · 7.69 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
############# builder #############
FROM golang:1.24.1 AS builder
WORKDIR /go/src/github.com/gardener/logging
COPY . .
RUN go mod download
RUN make plugin copy curator event-logger
############# distroless-static
FROM gcr.io/distroless/static-debian12:nonroot AS distroless-static
############# fluent-bit-plugin #############
FROM distroless-static AS fluent-bit-plugin
COPY --from=builder /go/src/github.com/gardener/logging/build/out_vali.so /source/plugins/out_vali.so
COPY --from=builder /go/src/github.com/gardener/logging/build/copy /bin/cp
WORKDIR /
CMD ["/bin/cp", "/source/plugins/out_vali.so", "/plugins"]
############# fluent-bit-vali #############
FROM ghcr.io/fluent/fluent-operator/fluent-bit:3.2.5 AS fluent-bit-vali
COPY --from=builder /go/src/github.com/gardener/logging/build/out_vali.so /fluent-bit/plugins/out_vali.so
WORKDIR /
CMD ["-e", "/fluent-bit/plugins/out_vali.so", "-c", "/fluent-bit/config/fluent-bit.conf"]
############# curator #############
FROM distroless-static AS curator
COPY --from=builder /go/src/github.com/gardener/logging/build/curator /curator
WORKDIR /
EXPOSE 2718
ENTRYPOINT [ "/curator" ]
############# eventlogger #############
FROM distroless-static AS event-logger
COPY --from=builder /go/src/github.com/gardener/logging/build/event-logger /event-logger
WORKDIR /
ENTRYPOINT [ "/event-logger" ]
############# telegraf-builder #############
FROM golang:1.24.1 AS telegraf-builder
RUN git clone --depth 1 --branch v1.26.0 https://github.com/influxdata/telegraf.git
WORKDIR /go/telegraf
ARG TARGETOS
ARG TARGETARCH
RUN --mount=type=cache,target="/root/.cache/go-build" CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build
############# iptables-builder #############
FROM alpine:3.21.3 AS iptables-builder
RUN apk add --update bash sudo iptables ncurses-libs libmnl && \
rm -rf /var/cache/apk/*
WORKDIR /volume
RUN mkdir -p ./bin ./sbin ./lib ./usr/bin ./usr/sbin ./usr/lib ./usr/lib/xtables ./usr/lib/bash ./tmp ./run ./etc/bash ./etc/openvpn ./usr/lib/openvpn/plugins ./etc/iproute2 ./etc/terminfo ./etc/logrotate.d ./etc/network/if-up.d ./usr/share/udhcpc ./etc/ssl/misc ./usr/lib/engines-1.1 ./run ./usr/lib/sudo \
&& cp -d /lib/ld-musl-* ./lib && echo "package musl" \
&& cp -d /lib/libc.musl-* ./lib && echo "package musl" \
&& cp -d -r /etc/terminfo/* ./etc/terminfo && echo "package ncurses-terminfo-base" \
&& cp -d /usr/lib/libformw.so.* ./usr/lib && echo "package ncurses-libs" \
&& cp -d /usr/lib/libmenuw.so.* ./usr/lib && echo "package ncurses-libs" \
&& cp -d /usr/lib/libncursesw.so.* ./usr/lib && echo "package ncurses-libs" \
&& cp -d /usr/lib/libpanelw.so.* ./usr/lib && echo "package ncurses-libs" \
&& cp -d /usr/lib/libreadline.so.* ./usr/lib && echo "package readline" \
&& cp -d /etc/inputrc ./etc && echo "package readline" \
&& cp -d /bin/bash ./bin && echo "package bash" \
&& cp -d /etc/bash/bashrc ./etc/bash && echo "package bash" \
&& cp -d /usr/lib/bash/* ./usr/lib/bash && echo "package bash" \
&& cp -d /usr/lib/libz.* ./lib && echo "package zlib" \
&& cp -d /usr/lib/libmnl.* ./usr/lib && echo "package libmnl" \
&& cp -d /usr/lib/libnftnl* ./usr/lib && echo "package libnftnl" \
&& cp -d /etc/ethertypes ./etc && echo "package iptables" \
&& cp -d /usr/sbin/iptables* ./sbin && echo "package iptables" \
&& cp -d /usr/sbin/xtables* ./sbin && echo "package iptables" \
&& cp -d /usr/lib/libxtables* ./usr/lib && echo "package iptables" \
&& cp -d /usr/lib/xtables/* ./usr/lib/xtables && echo "package iptables" \
&& cp -d /usr/lib/sudo/* ./usr/lib/sudo && echo "package sudo" \
&& cp -d /etc/sudoers ./etc && echo "package sudo" \
&& cp -d /etc/passwd ./etc && echo "package sudo" \
&& cp -d /usr/bin/sudo ./usr/sbin && echo "package sudo" \
&& touch ./run/xtables.lock && echo "create /run/xtables.lock"
############# telegraf #############
FROM scratch AS telegraf
COPY --from=iptables-builder /volume /
COPY --from=telegraf-builder /go/telegraf/telegraf /usr/bin/telegraf
CMD [ "/usr/bin/telegraf"]
############# tune2fs-builder #############
FROM alpine:3.21.3 AS tune2fs-builder
RUN apk add --update bash e2fsprogs-extra mount gawk ncurses-libs && \
rm -rf /var/cache/apk/*
WORKDIR /volume
RUN mkdir -p ./lib ./usr/bin/ ./bin ./etc/bash ./usr/lib/bash ./usr/sbin/ ./etc/terminfo \
&& cp -d /usr/bin/gawk ./usr/bin && echo "package gawk" \
&& cp -d /lib/ld-musl-* ./lib && echo "package musl" \
&& cp -d /lib/libc.musl-* ./lib && echo "package musl" \
&& cp -d /usr/lib/libmount.so.* ./lib && echo "package libmount" \
&& cp -d /usr/lib/libblkid.so.* ./lib && echo "package libblkid" \
&& cp -d /bin/mount ./bin && echo "package mount" \
&& cp -d -r /etc/terminfo/* ./etc/terminfo && echo "package ncurses-terminfo-base" \
&& cp -d /usr/lib/libformw.so.* ./usr/lib && echo "package ncurses-libs" \
&& cp -d /usr/lib/libmenuw.so.* ./usr/lib && echo "package ncurses-libs" \
&& cp -d /usr/lib/libncursesw.so.* ./usr/lib && echo "package ncurses-libs" \
&& cp -d /usr/lib/libpanelw.so.* ./usr/lib && echo "package ncurses-libs" \
&& cp -d /usr/lib/libreadline.so.* ./usr/lib && echo "package readline" \
&& cp -d /etc/inputrc ./etc && echo "package readline" \
&& cp -d /bin/bash ./bin && echo "package bash" \
&& cp -d /etc/bash/bashrc ./etc/bash && echo "package bash" \
&& cp -d /usr/lib/bash/* ./usr/lib/bash && echo "package bash" \
&& cp -d /usr/lib/libext2fs.so.* ./lib && echo "package e2fsprogs-extra" \
&& cp -d /usr/lib/libcom_err.so.* ./lib && echo "package e2fsprogs-extra" \
&& cp -d /usr/lib/libuuid.so.* ./lib && echo "package e2fsprogs-extra" \
&& cp -d /usr/lib/libe2p.so.* ./lib && echo "package e2fsprogs-extra" \
&& cp -d /usr/lib/libeconf.so.* ./lib && echo "package libeconf" \
&& cp -d /usr/sbin/tune2fs ./usr/sbin && echo "package e2fsprogs-extra"
############# tune2fs #############
FROM scratch AS tune2fs
COPY --from=tune2fs-builder /volume /
CMD [ "/usr/sbin/tune2fs"]