diff --git a/build/Dockerfile b/build/Dockerfile index 3700431..c2aa71e 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -49,7 +49,9 @@ RUN go mod download &&\ COPY cmd ./cmd COPY pkg ./pkg -RUN go build -o gotenberg -ldflags "-s -w -X 'github.com/gotenberg/gotenberg/v8/cmd.Version=$GOTENBERG_VERSION'" cmd/gotenberg/main.go +RUN go build -o gotenberg -ldflags "-s -w -X 'github.com/gotenberg/gotenberg/v8/cmd.Version=$GOTENBERG_VERSION'" cmd/gotenberg/main.go &&\ + go build -o gotenberg-chromium -ldflags "-s -w -X 'github.com/gotenberg/gotenberg/v8/cmd.Version=$GOTENBERG_VERSION'" cmd/gotenberg-chromium/main.go &&\ + go build -o gotenberg-libreoffice -ldflags "-s -w -X 'github.com/gotenberg/gotenberg/v8/cmd.Version=$GOTENBERG_VERSION'" cmd/gotenberg-libreoffice/main.go # ---------------------------------------------- # Custom JRE stage @@ -168,9 +170,8 @@ RUN \ # https://github.com/arachnys/athenapdf/commit/ba25a8d80a25d08d58865519c4cd8756dc9a336d. COPY --link build/fonts.conf /etc/fonts/conf.d/100-gotenberg.conf -# Copy the Golang binaries. +# Copy the pdfcpu binary (shared across all variants). COPY --link --from=pdfcpu-binary-stage /home/pdfcpu /usr/bin/ -COPY --link --from=gotenberg-binary-stage /home/gotenberg /usr/bin/ # Set default characterset encoding to UTF-8. # See: @@ -199,6 +200,9 @@ ARG GOTENBERG_VERSION=snapshot ARG GOTENBERG_USER_GID=1001 ARG GOTENBERG_USER_UID=1001 +# Copy the Gotenberg binary (full variant with all modules). +COPY --link --from=gotenberg-binary-stage /home/gotenberg /usr/bin/ + LABEL org.opencontainers.image.title="Gotenberg" \ org.opencontainers.image.description="A containerized API for seamless PDF conversion." \ org.opencontainers.image.version="$GOTENBERG_VERSION" \ @@ -265,6 +269,9 @@ ARG GOTENBERG_VERSION=snapshot ARG GOTENBERG_USER_GID=1001 ARG GOTENBERG_USER_UID=1001 +# Copy the Gotenberg binary (Chromium variant — no LibreOffice modules). +COPY --link --from=gotenberg-binary-stage /home/gotenberg-chromium /usr/bin/gotenberg + LABEL org.opencontainers.image.title="Gotenberg (Chromium)" \ org.opencontainers.image.description="A containerized API for seamless PDF conversion — Chromium variant." \ org.opencontainers.image.version="$GOTENBERG_VERSION" \ @@ -303,6 +310,9 @@ FROM common-stage AS gotenberg-libreoffice ARG GOTENBERG_VERSION=snapshot +# Copy the Gotenberg binary (LibreOffice variant — no Chromium modules). +COPY --link --from=gotenberg-binary-stage /home/gotenberg-libreoffice /usr/bin/gotenberg + LABEL org.opencontainers.image.title="Gotenberg (LibreOffice)" \ org.opencontainers.image.description="A containerized API for seamless PDF conversion — LibreOffice variant." \ org.opencontainers.image.version="$GOTENBERG_VERSION" \ diff --git a/cmd/gotenberg-chromium/main.go b/cmd/gotenberg-chromium/main.go new file mode 100644 index 0000000..f7b8d1c --- /dev/null +++ b/cmd/gotenberg-chromium/main.go @@ -0,0 +1,11 @@ +package main + +import ( + gotenbergcmd "github.com/gotenberg/gotenberg/v8/cmd" + // Gotenberg modules (Chromium variant — no LibreOffice). + _ "github.com/gotenberg/gotenberg/v8/pkg/standard/chromium" +) + +func main() { + gotenbergcmd.Run() +} diff --git a/cmd/gotenberg-libreoffice/main.go b/cmd/gotenberg-libreoffice/main.go new file mode 100644 index 0000000..a1f72a6 --- /dev/null +++ b/cmd/gotenberg-libreoffice/main.go @@ -0,0 +1,11 @@ +package main + +import ( + gotenbergcmd "github.com/gotenberg/gotenberg/v8/cmd" + // Gotenberg modules (LibreOffice variant — no Chromium). + _ "github.com/gotenberg/gotenberg/v8/pkg/standard/libreoffice" +) + +func main() { + gotenbergcmd.Run() +} diff --git a/pkg/standard/chromium/doc.go b/pkg/standard/chromium/doc.go new file mode 100644 index 0000000..939f047 --- /dev/null +++ b/pkg/standard/chromium/doc.go @@ -0,0 +1,3 @@ +// Package chromium imports the application's modules for the Chromium-only +// variant (no LibreOffice). +package chromium diff --git a/pkg/standard/chromium/imports.go b/pkg/standard/chromium/imports.go new file mode 100644 index 0000000..cf6b5ef --- /dev/null +++ b/pkg/standard/chromium/imports.go @@ -0,0 +1,14 @@ +package chromium + +import ( + // Gotenberg modules (Chromium variant — no LibreOffice). + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/api" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/chromium" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/exiftool" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/pdfcpu" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/pdfengines" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/pdftk" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/prometheus" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/qpdf" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/webhook" +) diff --git a/pkg/standard/libreoffice/doc.go b/pkg/standard/libreoffice/doc.go new file mode 100644 index 0000000..a4fe86e --- /dev/null +++ b/pkg/standard/libreoffice/doc.go @@ -0,0 +1,3 @@ +// Package libreoffice imports the application's modules for the +// LibreOffice-only variant (no Chromium). +package libreoffice diff --git a/pkg/standard/libreoffice/imports.go b/pkg/standard/libreoffice/imports.go new file mode 100644 index 0000000..ad2f2de --- /dev/null +++ b/pkg/standard/libreoffice/imports.go @@ -0,0 +1,16 @@ +package libreoffice + +import ( + // Gotenberg modules (LibreOffice variant — no Chromium). + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/api" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/exiftool" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/libreoffice" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/libreoffice/api" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/libreoffice/pdfengine" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/pdfcpu" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/pdfengines" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/pdftk" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/prometheus" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/qpdf" + _ "github.com/gotenberg/gotenberg/v8/pkg/modules/webhook" +)