Skip to content

Commit 2a6488e

Browse files
committed
Add alpine-glibc
Signed-off-by: Liam Newman <liam@verta.ai>
1 parent 7db9a8c commit 2a6488e

File tree

3 files changed

+49
-22
lines changed

3 files changed

+49
-22
lines changed

alpine-glibc/Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
ARG ARCH=""
2+
FROM ${ARCH}debian:buster-slim
3+
4+
RUN \
5+
apt-get update && apt-get install -y --no-install-recommends \
6+
ca-certificates \
7+
gcc \
8+
netbase \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
RUN set -x \
12+
&& mkdir -p rootfs/lib \
13+
&& set -- \
14+
/etc/nsswitch.conf \
15+
/etc/ssl/certs/ca-certificates.crt \
16+
/usr/share/zoneinfo \
17+
/etc/services \
18+
/lib/"$(gcc -print-multiarch)"/libpthread.so.* \
19+
&& while [ "$#" -gt 0 ]; do \
20+
f="$1"; shift; \
21+
fn="$(basename "$f")"; \
22+
if [ -e "rootfs/lib/$fn" ]; then continue; fi; \
23+
if [ "${f#/lib/}" != "$f" ]; then \
24+
ln -vL "$f" "rootfs/lib/$fn"; \
25+
else \
26+
d="$(dirname $f)" \
27+
&& mkdir -p "rootfs/${d#/}" \
28+
&& cp -av "$f" "rootfs/${f#/}"; \
29+
fi; \
30+
done
31+
32+
FROM ${ARCH}alpine:latest as alpine
33+
RUN apk add busybox-static && \
34+
rm /bin/* && \
35+
/tmp/busybox --install /bin && \
36+
mv /tmp/busybox /bin/
37+
38+
FROM ${ARCH}busybox:glibc
39+
MAINTAINER The Prometheus Authors <prometheus-developers@googlegroups.com>
40+
41+
# Use the busybox executable from alpine which is generally patched more quickly for vulnerabilities
42+
# Use the busybox.static to avoid dynamic library dependencies.
43+
COPY --from=alpine /bin/busybox.static /tmp/busybox
44+
45+
RUN rm /bin/* && \
46+
/tmp/busybox --install /bin && \
47+
mv /tmp/busybox /bin/
48+
49+
COPY --from=0 /rootfs /

glibc/Dockerfile

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,7 @@ RUN set -x \
2929
fi; \
3030
done
3131

32-
FROM ${ARCH}alpine:latest as alpine
33-
RUN apk add busybox-static
34-
3532
FROM ${ARCH}busybox:glibc
3633
MAINTAINER The Prometheus Authors <prometheus-developers@googlegroups.com>
3734

38-
# Use the busybox executable from alpine which is generally patched more quickly for vulnerabilities
39-
# Use the busybox.static to avoid dynamic library dependencies.
40-
COPY --from=alpine /bin/busybox.static /tmp/busybox
41-
42-
RUN rm /bin/* && \
43-
/tmp/busybox --install /bin && \
44-
mv /tmp/busybox /bin/
45-
4635
COPY --from=0 /rootfs /

uclibc/Dockerfile

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,7 @@ RUN set -x \
2828
fi; \
2929
done
3030

31-
FROM ${ARCH}alpine:latest as alpine
32-
RUN apk add busybox-static
33-
3431
FROM ${ARCH}busybox:uclibc
3532
MAINTAINER The Prometheus Authors <prometheus-developers@googlegroups.com>
3633

37-
# Use the busybox executable from alpine which is generally patched more quickly for vulnerabilities
38-
# Use the busybox.static to avoid dynamic library dependencies.
39-
COPY --from=alpine /bin/busybox.static /tmp/busybox
40-
41-
RUN rm /bin/* && \
42-
/tmp/busybox --install /bin && \
43-
mv /tmp/busybox /bin/
44-
4534
COPY --from=0 /rootfs /

0 commit comments

Comments
 (0)