Skip to content

Commit

Permalink
Adds debian tar to distroless image
Browse files Browse the repository at this point in the history
Inlcudes `tar` and its transitive dependencies to the distrol image
in order to address #29262
  • Loading branch information
tcsc committed Jul 19, 2023
1 parent 2099ccc commit 535c5d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 6 additions & 6 deletions build.assets/charts/Dockerfile-distroless
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ARG BASE_IMAGE=gcr.io/distroless/cc-debian11

FROM debian:11 AS staging
RUN apt-get update
COPY fetch-debs ./
RUN ./fetch-debs dumb-init libpam0g libaudit1 libcap-ng0
RUN apt-get update
RUN --mount=type=bind,target=/context \
/context/fetch-debs dumb-init libpam0g libaudit1 libcap-ng0 libacl1 libselinux1 libpcre2-8-0 tar

FROM debian:11 AS teleport
# Install the teleport binary from an architecture-specific debian package. Note
Expand All @@ -21,8 +21,8 @@ ARG TELEPORT_VERSION
# TARGETARCH is supplied by the `buildx` mechanics
ARG TARGETARCH
ENV TELEPORT_DEB_FILE_NAME=teleport${TELEPORT_RELEASE_INFIX}_${TELEPORT_VERSION}${TELEPORT_FIPS_INFIX}_${TARGETARCH}.deb
COPY $TELEPORT_DEB_FILE_NAME ./$TELEPORT_DEB_FILE_NAME
RUN dpkg-deb -R $TELEPORT_DEB_FILE_NAME /opt/staging && \
RUN --mount=type=bind,target=/context \
dpkg-deb -R /context/${TELEPORT_DEB_FILE_NAME} /opt/staging && \
mkdir -p /opt/staging/etc/teleport && \
mkdir -p /opt/staging/var/lib/dpkg/status.d/ && \
mv /opt/staging/DEBIAN/control /opt/staging/var/lib/dpkg/status.d/teleport && \
Expand All @@ -32,4 +32,4 @@ FROM $BASE_IMAGE
COPY --from=teleport /opt/staging /
COPY --from=staging /opt/staging/root /
COPY --from=staging /opt/staging/status /var/lib/dpkg/status.d
ENTRYPOINT ["/usr/bin/dumb-init", "/usr/local/bin/teleport", "start", "-c", "/etc/teleport/teleport.yaml"]
ENTRYPOINT ["/usr/bin/dumb-init", "/usr/local/bin/teleport", "start", "-c", "/etc/teleport/teleport.yaml"]
6 changes: 5 additions & 1 deletion build.assets/charts/fetch-debs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e
mkdir -p /opt/staging/root
mkdir -p /opt/staging/status

Expand All @@ -8,4 +9,7 @@ for pkg in "$@"; do
rm -r /tmp/$pkg/DEBIAN
cp -r /tmp/$pkg/* /opt/staging/root
rm -rf /tmp/$pkg
done
done

rm -rf /opt/staging/root/usr/share/locale
rm -rf /opt/staging/root/usr/share/doc

0 comments on commit 535c5d0

Please sign in to comment.