Skip to content

Commit 6114bf7

Browse files
authored
Revert to a working state after failed CVE remediation (#7)
* Revert "Distroless fix (#6)" This reverts commit 9592d71. * Revert "Use python distroless instead of copying python into google distroless, as 2F scanning does not like that for some reason (#5)" This reverts commit df7d12b.
1 parent 9592d71 commit 6114bf7

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

build/Dockerfile.distroless

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# This is our strategy for getting a clean (from CVE perspective) base image for python-based services.
2+
# This mostly takes from https://github.com/alexdmoss/distroless-python
3+
# We need to build our own to be able to get new debian versions with fixes.
4+
5+
# Google periodically updates distroless images but just uses latest
6+
# CVEs will typically get fixed in versions (e.g deb12u7) and we'll need to rebuild this to incorporate them.
7+
ARG GOOGLE_DISTROLESS_BASE_IMAGE=gcr.io/distroless/cc-debian12:latest
8+
19
# ARG instructions do not create additional layers. Instead, next layers will
210
# concatenate them. Also, we have to repeat ARG instructions in each build
311
# stage that uses them.
@@ -173,15 +181,10 @@ RUN \
173181
# https://github.com/arachnys/athenapdf/commit/ba25a8d80a25d08d58865519c4cd8756dc9a336d.
174182
COPY build/fonts.conf /etc/fonts/conf.d/100-gotenberg.conf
175183

176-
# ----------------------------------------------
177-
# Python copy stage
178-
# ----------------------------------------------
179-
FROM public.ecr.aws/j9h1x6x3/distroless-python:latest AS python-source
180-
181184
# ----------------------------------------------
182185
# Final stage
183186
# ----------------------------------------------
184-
FROM gcr.io/distroless/cc-debian12:latest AS base
187+
FROM ${GOOGLE_DISTROLESS_BASE_IMAGE} AS base
185188

186189
# Set platform-specific CHIPSET_ARCH
187190
FROM base AS base-amd64
@@ -196,9 +199,9 @@ ARG TARGETARCH
196199
FROM base-${TARGETARCH}
197200

198201
# Required for unoconverter
199-
COPY --from=python-source /usr/local/bin/python /usr/bin/python
200-
COPY --from=python-source /usr/local/bin/python /usr/bin/python3
201-
COPY --from=python-source /usr/local/bin/python /usr/bin/python3.11
202+
COPY --from=gotenberg-binary-stage /usr/bin/python /usr/bin/python
203+
COPY --from=gotenberg-binary-stage /usr/lib/python3 /usr/lib/python3
204+
COPY --from=gotenberg-binary-stage /usr/lib/python3.11 /usr/lib/python3.11
202205

203206
ENV PYTHONPATH="/usr/local/lib/python3.11/dist-packages:"
204207

0 commit comments

Comments
 (0)