Skip to content

Commit

Permalink
Add ARM dependencies to metadata prefetch Dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
hime committed Nov 20, 2024
1 parent f3b2756 commit 2bdd8f4
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions cmd/metadata_prefetch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,31 @@ RUN make metadata-prefetch BINDIR=/bin
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
# We use `gcr.io/distroless/base` because it includes glibc.
FROM gcr.io/distroless/base-debian12 AS distroless-base

# 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
Expand Down

0 comments on commit 2bdd8f4

Please sign in to comment.