From a3984054d74dd4be79d4961ab52ede522cc11bb7 Mon Sep 17 00:00:00 2001 From: hime <jaimebz@google.com> Date: Wed, 20 Nov 2024 21:46:49 +0000 Subject: [PATCH] Add ARM dependencies to metadata prefetch Dockerfile. --- cmd/metadata_prefetch/Dockerfile | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/cmd/metadata_prefetch/Dockerfile b/cmd/metadata_prefetch/Dockerfile index 74bf24a2..9359bec7 100644 --- a/cmd/metadata_prefetch/Dockerfile +++ b/cmd/metadata_prefetch/Dockerfile @@ -25,17 +25,28 @@ RUN make metadata-prefetch BINDIR=/bin # go/gke-releasing-policies#base-images FROM gke.gcr.io/debian-base:bookworm-v1.0.4-gke.2 AS debian -# go/gke-releasing-policies#base-images -FROM gcr.io/distroless/base-debian12 AS output-image +# The distroless amd64 image has a target triplet of x86_64 +FROM distroless-base AS distroless-amd64 +ENV LIB_DIR_PREFIX=x86_64 +ENV LD_LINUX_FILE=/lib64/ld-linux-x86-64.so.2 +ENV LIB_DIR=/lib64/ + +# The distroless arm64 image has a target triplet of aarch64 +FROM distroless-base AS distroless-arm64 +ENV LIB_DIR_PREFIX aarch64 +ENV LD_LINUX_FILE /lib/ld-linux-aarch64.so.1 +ENV LIB_DIR /lib/ +# go/gke-releasing-policies#base-images +FROM distroless-$TARGETARCH AS output-image # Copy existing binaries. COPY --from=debian /bin/ls /bin/ls # Copy dependencies. -COPY --from=debian /lib/x86_64-linux-gnu/libselinux.so.1 /lib/x86_64-linux-gnu/libselinux.so.1 -COPY --from=debian /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6 -COPY --from=debian /lib/x86_64-linux-gnu/libpcre2-8.so.0 /lib/x86_64-linux-gnu/libpcre2-8.so.0 -COPY --from=debian /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 +COPY --from=debian /lib/${LIB_DIR_PREFIX}-linux-gnu/libselinux.so.1 /lib/${LIB_DIR_PREFIX}-linux-gnu/libselinux.so.1 +COPY --from=debian /lib/${LIB_DIR_PREFIX}-linux-gnu/libc.so.6 /lib/${LIB_DIR_PREFIX}-linux-gnu/libc.so.6 +COPY --from=debian /lib/${LIB_DIR_PREFIX}-linux-gnu/libpcre2-8.so.0 /lib/${LIB_DIR_PREFIX}-linux-gnu/libpcre2-8.so.0 +COPY --from=debian ${LD_LINUX_FILE} ${LIB_DIR} # Validate dependencies FROM output-image AS validator-image