@@ -81,8 +81,51 @@ COPY conf/fluent-bit.conf \
81
81
conf/plugins.conf \
82
82
/fluent-bit/etc/
83
83
84
- # FROM gcr.io/distroless/cc-debian11 as production
85
- FROM debian:bullseye-slim as production
84
+ # Simple example of how to properly extract packages for reuse in distroless
85
+ # Taken from: https://github.com/GoogleContainerTools/distroless/issues/863
86
+ FROM debian:bullseye-slim as deb-extractor
87
+ COPY --from=qemu-arm32 /usr/bin/qemu-arm-static /usr/bin/
88
+ COPY --from=qemu-arm64 /usr/bin/qemu-aarch64-static /usr/bin/
89
+
90
+ # We download all debs locally then extract them into a directory we can use as the root for distroless
91
+ WORKDIR /tmp
92
+ RUN apt-get update && \
93
+ apt-get download \
94
+ libssl1.1 \
95
+ libsasl2-2 \
96
+ pkg-config \
97
+ libpq5 \
98
+ libsystemd0 \
99
+ zlib1g \
100
+ ca-certificates \
101
+ libatomic1 \
102
+ libgcrypt20 \
103
+ libzstd1 \
104
+ liblz4-1 \
105
+ libgssapi-krb5-2 \
106
+ libldap-2.4-2 \
107
+ libgpg-error0 \
108
+ libkrb5-3 \
109
+ libk5crypto3 \
110
+ libcom-err2 \
111
+ libkrb5support0 \
112
+ libgnutls30 \
113
+ libkeyutils1 \
114
+ libp11-kit0 \
115
+ libidn2-0 \
116
+ libunistring2 \
117
+ libtasn1-6 \
118
+ libnettle8 \
119
+ libhogweed6 \
120
+ libgmp10 \
121
+ libffi7 \
122
+ liblzma5 && \
123
+ mkdir -p /dpkg && \
124
+ for deb in *.deb; do dpkg --extract "$deb" /dpkg || exit 10; done
125
+
126
+ # We want latest at time of build
127
+ # hadolint ignore=DL3006
128
+ FROM gcr.io/distroless/cc-debian11 as production
86
129
LABEL description="Fluent Bit multi-architecture container image" \
87
130
vendor="Fluent Organization" \
88
131
version="1.9.0" \
@@ -96,34 +139,18 @@ LABEL description="Fluent Bit multi-architecture container image" \
96
139
org.opencontainers.image.documentation="https://docs.fluentbit.io/manual/" \
97
140
org.opencontainers.image.authors="Eduardo Silva <eduardo@calyptia.com>"
98
141
99
- COPY --from=qemu-arm32 /usr/bin/qemu-arm-static /usr/bin/
100
- COPY --from=qemu-arm64 /usr/bin/qemu-aarch64-static /usr/bin/
101
-
102
- # hadolint ignore=DL3008
103
- RUN apt-get update && \
104
- apt-get install -y --no-install-recommends \
105
- libssl1.1 \
106
- libsasl2-2 \
107
- pkg-config \
108
- libpq5 \
109
- libsystemd0 \
110
- zlib1g \
111
- ca-certificates \
112
- libatomic1 \
113
- libgcrypt20 \
114
- && apt-get clean \
115
- && rm -rf /var/lib/apt/lists/*
142
+ # Copy the libraries from the extractor stage into root
143
+ COPY --from=deb-extractor /dpkg /
116
144
117
145
COPY --from=builder /fluent-bit /fluent-bit
118
- RUN rm -f /usr/bin/qemu-*-static
119
146
120
147
EXPOSE 2020
121
148
122
149
# Entry point
123
150
ENTRYPOINT [ "/fluent-bit/bin/fluent-bit" ]
124
151
CMD ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluent-bit.conf"]
125
152
126
- FROM production as debug
153
+ FROM debian:bullseye-slim as debug
127
154
LABEL description="Fluent Bit multi-architecture container image" \
128
155
vendor="Fluent Organization" \
129
156
version="1.9.0" \
@@ -136,14 +163,23 @@ ENV DEBIAN_FRONTEND noninteractive
136
163
# hadolint ignore=DL3008
137
164
RUN apt-get update && \
138
165
apt-get install -y --no-install-recommends \
139
- bash gdb valgrind build-essential \
166
+ libssl1.1 \
167
+ libsasl2-2 \
168
+ pkg-config \
169
+ libpq5 \
170
+ libsystemd0 \
171
+ zlib1g \
172
+ ca-certificates \
173
+ libatomic1 \
174
+ libgcrypt20 \
175
+ bash gdb valgrind build-essential \
140
176
&& apt-get clean \
141
177
&& rm -rf /var/lib/apt/lists/*
142
178
143
179
RUN rm -f /usr/bin/qemu-*-static
180
+ COPY --from=builder /fluent-bit /fluent-bit
144
181
145
182
EXPOSE 2020
146
183
147
- # Entry point
148
- ENTRYPOINT [ "/fluent-bit/bin/fluent-bit" ]
184
+ # No entry point so we can just shell in
149
185
CMD ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluent-bit.conf"]
0 commit comments