Skip to content

Commit 55ea327

Browse files
authored
build(distroless): use uutils/coreutils for df binary (#1152)
Replace Alpine's coreutils package with the uutils/coreutils multicall binary from the official GitHub release. This reduces the build dependency and uses a Rust-based implementation of df. The multicall binary is symlinked as `df` so it dispatches correctly via argv[0].
1 parent cef2a97 commit 55ea327

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

distribution/containers/Dockerfile.distroless

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,17 @@ RUN if [[ `uname -m` == "aarch64" ]]; \
1414
RUN mv flood /root/sysroot/bin/flood
1515

1616

17-
RUN apk --no-cache add tini-static coreutils
18-
RUN cp /bin/df /root/sysroot/bin/df
17+
ARG COREUTILS_VERSION=0.9.0
18+
ARG TARGETARCH
19+
RUN if [ "$TARGETARCH" = "arm64" ]; then COREUTILS_ARCH="aarch64"; else COREUTILS_ARCH="x86_64"; fi \
20+
&& wget -qO /tmp/coreutils.tar.gz \
21+
"https://github.com/uutils/coreutils/releases/download/${COREUTILS_VERSION}/coreutils-${COREUTILS_VERSION}-${COREUTILS_ARCH}-unknown-linux-musl.tar.gz" \
22+
&& tar xzf /tmp/coreutils.tar.gz -C /tmp \
23+
&& mv /tmp/coreutils-${COREUTILS_VERSION}-${COREUTILS_ARCH}-unknown-linux-musl/coreutils /root/sysroot/bin/coreutils \
24+
&& ln -s coreutils /root/sysroot/bin/df \
25+
&& rm -rf /tmp/coreutils.tar.gz /tmp/coreutils-*
26+
27+
RUN apk --no-cache add tini-static
1928
RUN cp /sbin/tini-static /root/sysroot/bin/tini
2029

2130
RUN chmod 0555 /root/sysroot/bin/*

0 commit comments

Comments
 (0)