Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions images/local-path-helper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# This image is contains the binaries needed for the local-path-provisioner
# helper pod. Currently that means: sh, rm, mkdir

ARG BASE="registry.k8s.io/build-image/debian-base:bullseye-v1.4.3"
ARG BASE="registry.k8s.io/build-image/debian-base:bookworm-v1.0.5"
FROM ${BASE} AS build

# NOTE: copyrights.tar.gz is a quirk of Kubernetes's debian-base image
Expand All @@ -42,6 +42,6 @@ RUN mkdir -p "${STAGE_DIR}" && \
find "${STAGE_DIR}"

# copy staged binary + deps + copyright into distroless
FROM "gcr.io/distroless/static-debian11"
FROM "gcr.io/distroless/static-debian12"
ARG STAGE_DIR="/opt/stage"
COPY --from=build "${STAGE_DIR}/" /
3 changes: 2 additions & 1 deletion images/local-path-helper/stage-binary-and-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ file_to_package() {
# `dpkg-query --search $file-pattern` outputs lines with the format: "$package: $file-path"
# where $file-path belongs to $package
# https://manpages.debian.org/jessie/dpkg/dpkg-query.1.en.html
dpkg-query --search "$(realpath "${1}")" | cut -d':' -f1
# Match bash path in dpkg regardless of /usr merge
dpkg-query --search "$(realpath "${1}" | sed 's|/usr|*|')" | cut -d':' -f1
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced /usr/bin/bash with a wildcard match (*/bin/bash) in dpkg-query to handle systems with merged /usr layout. This ensures compatibility where bash is symlinked to /usr/bin/bash, but only /bin/bash is recorded in the package database

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of sed, we can realpath the output path?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

realpath resolves to /usr/bin/bash on merged /usr systems, but dpkg-query only matches /bin/bash in the package database. The sed wildcard workaround does work for these cases, though I’m exploring whether there’s a more canonical or robust way to handle this mismatch. I’d appreciate any suggestions you might have.


# package_to_copyright gives the path to the copyright file for the package $1
Expand Down
2 changes: 1 addition & 1 deletion images/local-path-provisioner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN eval "$(gimme "${GO_VERSION}")" \
&& GOBIN=/usr/local/bin go install github.com/google/go-licenses@latest \
&& GOARCH=$TARGETARCH go-licenses save --save_path=/_LICENSES .

FROM gcr.io/distroless/base-debian11
FROM gcr.io/distroless/base-debian12
COPY --from=0 /usr/local/bin/local-path-provisioner /usr/local/bin/local-path-provisioner
COPY --from=0 /_LICENSES/* /LICENSES/
COPY --chmod=0644 files/LICENSES/* /LICENSES/*
Expand Down
Loading