From f8809b394357daa5e67c98551f2aec0724f57d62 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Sun, 29 Mar 2026 21:10:35 +0200 Subject: [PATCH] feat(Dockerfile): no dedicated Dockerfiles for AWS and Cloud Run + chromium/libreoffice only variants --- .env | 2 - build/Dockerfile | 117 ++++++++++++++++++++++++++++++++++++ build/Dockerfile.aws-lambda | 21 ------- build/Dockerfile.cloudrun | 22 ------- 4 files changed, 117 insertions(+), 45 deletions(-) delete mode 100644 build/Dockerfile.aws-lambda delete mode 100644 build/Dockerfile.cloudrun diff --git a/.env b/.env index 5a05069..c25eafa 100644 --- a/.env +++ b/.env @@ -2,7 +2,5 @@ GOTENBERG_VERSION=snapshot DOCKER_REGISTRY=gotenberg DOCKER_REPOSITORY=gotenberg DOCKERFILE=build/Dockerfile -DOCKERFILE_CLOUDRUN=build/Dockerfile.cloudrun -DOCKERFILE_AWS_LAMBDA=build/Dockerfile.aws-lambda DOCKER_BUILD_CONTEXT='.' TARGET=gotenberg diff --git a/build/Dockerfile b/build/Dockerfile index d406050..3700431 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -345,3 +345,120 @@ EXPOSE 3000 ENTRYPOINT [ "/usr/bin/tini", "--" ] CMD [ "gotenberg" ] + +# ============================================================== +# Cloud Run variants +# ============================================================== + +# ---------------------------------------------- +# Cloud Run: full (Chromium + LibreOffice) +# ---------------------------------------------- +FROM gotenberg AS gotenberg-cloudrun + +USER root + +# For security reasons, the non-root user gotenberg does not own the Tini binary by default. +# However, some providers like Cloud Run from Google Cloud cannot start a Docker container in that case. +# See https://github.com/gotenberg/gotenberg/issues/90#issuecomment-543551353. +RUN chown gotenberg: /usr/bin/tini + +ENV API_PORT_FROM_ENV=PORT +ENV CHROMIUM_AUTO_START=true +ENV LIBREOFFICE_AUTO_START=true +ENV WEBHOOK_ENABLE_SYNC_MODE=true +ENV GOTENBERG_BUILD_DEBUG_DATA=false +ENV LOG_ENABLE_GCP_FIELDS=true + +USER gotenberg + +# ---------------------------------------------- +# Cloud Run: Chromium only +# ---------------------------------------------- +FROM gotenberg-chromium AS gotenberg-cloudrun-chromium + +USER root + +RUN chown gotenberg: /usr/bin/tini + +ENV API_PORT_FROM_ENV=PORT +ENV CHROMIUM_AUTO_START=true +ENV WEBHOOK_ENABLE_SYNC_MODE=true +ENV GOTENBERG_BUILD_DEBUG_DATA=false +ENV LOG_ENABLE_GCP_FIELDS=true + +USER gotenberg + +# ---------------------------------------------- +# Cloud Run: LibreOffice only +# ---------------------------------------------- +FROM gotenberg-libreoffice AS gotenberg-cloudrun-libreoffice + +USER root + +RUN chown gotenberg: /usr/bin/tini + +ENV API_PORT_FROM_ENV=PORT +ENV LIBREOFFICE_AUTO_START=true +ENV WEBHOOK_ENABLE_SYNC_MODE=true +ENV GOTENBERG_BUILD_DEBUG_DATA=false +ENV LOG_ENABLE_GCP_FIELDS=true + +USER gotenberg + +# ============================================================== +# AWS Lambda variants +# ============================================================== + +# ---------------------------------------------- +# AWS Lambda: full (Chromium + LibreOffice) +# ---------------------------------------------- +FROM gotenberg AS gotenberg-aws-lambda + +USER root + +COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter + +ENV AWS_LWA_PORT=3000 +ENV AWS_LWA_READINESS_CHECK_PATH=/health +ENV AWS_LWA_INVOKE_MODE=buffered +ENV API_PORT_FROM_ENV=AWS_LWA_PORT +ENV WEBHOOK_ENABLE_SYNC_MODE=true +ENV GOTENBERG_BUILD_DEBUG_DATA=false + +USER gotenberg + +# ---------------------------------------------- +# AWS Lambda: Chromium only +# ---------------------------------------------- +FROM gotenberg-chromium AS gotenberg-aws-lambda-chromium + +USER root + +COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter + +ENV AWS_LWA_PORT=3000 +ENV AWS_LWA_READINESS_CHECK_PATH=/health +ENV AWS_LWA_INVOKE_MODE=buffered +ENV API_PORT_FROM_ENV=AWS_LWA_PORT +ENV WEBHOOK_ENABLE_SYNC_MODE=true +ENV GOTENBERG_BUILD_DEBUG_DATA=false + +USER gotenberg + +# ---------------------------------------------- +# AWS Lambda: LibreOffice only +# ---------------------------------------------- +FROM gotenberg-libreoffice AS gotenberg-aws-lambda-libreoffice + +USER root + +COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter + +ENV AWS_LWA_PORT=3000 +ENV AWS_LWA_READINESS_CHECK_PATH=/health +ENV AWS_LWA_INVOKE_MODE=buffered +ENV API_PORT_FROM_ENV=AWS_LWA_PORT +ENV WEBHOOK_ENABLE_SYNC_MODE=true +ENV GOTENBERG_BUILD_DEBUG_DATA=false + +USER gotenberg diff --git a/build/Dockerfile.aws-lambda b/build/Dockerfile.aws-lambda deleted file mode 100644 index 858f2a3..0000000 --- a/build/Dockerfile.aws-lambda +++ /dev/null @@ -1,21 +0,0 @@ -ARG DOCKER_REGISTRY -ARG DOCKER_REPOSITORY -ARG GOTENBERG_VERSION - -FROM $DOCKER_REGISTRY/$DOCKER_REPOSITORY:$GOTENBERG_VERSION - -USER root - -COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 /lambda-adapter /opt/extensions/lambda-adapter - -# AWS. -ENV AWS_LWA_PORT=3000 -ENV AWS_LWA_READINESS_CHECK_PATH=/health -ENV AWS_LWA_INVOKE_MODE=buffered - -# Gotenberg. -ENV API_PORT_FROM_ENV=AWS_LWA_PORT -ENV WEBHOOK_ENABLE_SYNC_MODE=true -ENV GOTENBERG_BUILD_DEBUG_DATA=false - -USER gotenberg diff --git a/build/Dockerfile.cloudrun b/build/Dockerfile.cloudrun deleted file mode 100644 index 7e68a6c..0000000 --- a/build/Dockerfile.cloudrun +++ /dev/null @@ -1,22 +0,0 @@ -ARG DOCKER_REGISTRY -ARG DOCKER_REPOSITORY -ARG GOTENBERG_VERSION - -FROM $DOCKER_REGISTRY/$DOCKER_REPOSITORY:$GOTENBERG_VERSION - -USER root - -# For security reasons, the non-root user gotenberg does not own the Tini binary by default. -# However, some providers like Cloud Run from Google Cloud cannot start a Docker container in that case. -# See https://github.com/gotenberg/gotenberg/issues/90#issuecomment-543551353. -RUN chown gotenberg: /usr/bin/tini - -# Gotenberg. -ENV API_PORT_FROM_ENV=PORT -ENV CHROMIUM_AUTO_START=true -ENV LIBREOFFICE_AUTO_START=true -ENV WEBHOOK_ENABLE_SYNC_MODE=true -ENV GOTENBERG_BUILD_DEBUG_DATA=false -ENV LOG_ENABLE_GCP_FIELDS=true - -USER gotenberg