Skip to content

Commit

Permalink
Use static linked busybox
Browse files Browse the repository at this point in the history
  • Loading branch information
liam-verta committed Nov 17, 2022
1 parent 67a9d1a commit 703a099
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions glibc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,16 @@ RUN set -x \
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
COPY --from=alpine /bin/busybox /tmp/busybox
COPY --from=alpine /lib/ld-musl* /lib/libc.musl* /lib/
# Use the busybox.static to avoid dynamic library dependencies.
COPY --from=alpine /bin/busybox.static /tmp/busybox

RUN cd /lib && \
ln -sf $(ls ld-musl*) $(ls libc.musl*) && \
rm /bin/* && \
RUN rm /bin/* && \
/tmp/busybox --install /bin && \
mv /tmp/busybox /bin/

Expand Down
9 changes: 4 additions & 5 deletions uclibc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ RUN set -x \
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
COPY --from=alpine /bin/busybox /tmp/busybox
COPY --from=alpine /lib/ld-musl* /lib/libc.musl* /lib/
# Use the busybox.static to avoid dynamic library dependencies.
COPY --from=alpine /bin/busybox.static /tmp/busybox

RUN cd /lib && \
ln -sf $(ls ld-musl*) $(ls libc.musl*) && \
rm /bin/* && \
RUN rm /bin/* && \
/tmp/busybox --install /bin && \
mv /tmp/busybox /bin/

Expand Down

0 comments on commit 703a099

Please sign in to comment.