Skip to content

Commit

Permalink
Add alpine-glibc
Browse files Browse the repository at this point in the history
Signed-off-by: Liam Newman <[email protected]>
  • Loading branch information
liam-verta committed Nov 18, 2022
1 parent 7db9a8c commit 2a6488e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 22 deletions.
49 changes: 49 additions & 0 deletions alpine-glibc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
ARG ARCH=""
FROM ${ARCH}debian:buster-slim

RUN \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
netbase \
&& rm -rf /var/lib/apt/lists/*

RUN set -x \
&& mkdir -p rootfs/lib \
&& set -- \
/etc/nsswitch.conf \
/etc/ssl/certs/ca-certificates.crt \
/usr/share/zoneinfo \
/etc/services \
/lib/"$(gcc -print-multiarch)"/libpthread.so.* \
&& while [ "$#" -gt 0 ]; do \
f="$1"; shift; \
fn="$(basename "$f")"; \
if [ -e "rootfs/lib/$fn" ]; then continue; fi; \
if [ "${f#/lib/}" != "$f" ]; then \
ln -vL "$f" "rootfs/lib/$fn"; \
else \
d="$(dirname $f)" \
&& mkdir -p "rootfs/${d#/}" \
&& cp -av "$f" "rootfs/${f#/}"; \
fi; \
done

FROM ${ARCH}alpine:latest as alpine
RUN apk add busybox-static && \
rm /bin/* && \
/tmp/busybox --install /bin && \
mv /tmp/busybox /bin/

FROM ${ARCH}busybox:glibc
MAINTAINER The Prometheus Authors <[email protected]>

# Use the busybox executable from alpine which is generally patched more quickly for vulnerabilities
# Use the busybox.static to avoid dynamic library dependencies.
COPY --from=alpine /bin/busybox.static /tmp/busybox

RUN rm /bin/* && \
/tmp/busybox --install /bin && \
mv /tmp/busybox /bin/

COPY --from=0 /rootfs /
11 changes: 0 additions & 11 deletions glibc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,7 @@ RUN set -x \
fi; \
done

FROM ${ARCH}alpine:latest as alpine
RUN apk add busybox-static

FROM ${ARCH}busybox:glibc
MAINTAINER The Prometheus Authors <[email protected]>

# Use the busybox executable from alpine which is generally patched more quickly for vulnerabilities
# Use the busybox.static to avoid dynamic library dependencies.
COPY --from=alpine /bin/busybox.static /tmp/busybox

RUN rm /bin/* && \
/tmp/busybox --install /bin && \
mv /tmp/busybox /bin/

COPY --from=0 /rootfs /
11 changes: 0 additions & 11 deletions uclibc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,7 @@ RUN set -x \
fi; \
done

FROM ${ARCH}alpine:latest as alpine
RUN apk add busybox-static

FROM ${ARCH}busybox:uclibc
MAINTAINER The Prometheus Authors <[email protected]>

# Use the busybox executable from alpine which is generally patched more quickly for vulnerabilities
# Use the busybox.static to avoid dynamic library dependencies.
COPY --from=alpine /bin/busybox.static /tmp/busybox

RUN rm /bin/* && \
/tmp/busybox --install /bin && \
mv /tmp/busybox /bin/

COPY --from=0 /rootfs /

0 comments on commit 2a6488e

Please sign in to comment.