feat(main): add dedicated Go entrypoints for libreoffice / chromium only variants

This commit is contained in:
Julien Neuhart
2026-03-29 21:17:57 +02:00
parent f8809b3943
commit bf0d0a4f40
7 changed files with 71 additions and 3 deletions
+13 -3
View File
@@ -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" \
+11
View File
@@ -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()
}
+11
View File
@@ -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()
}
+3
View File
@@ -0,0 +1,3 @@
// Package chromium imports the application's modules for the Chromium-only
// variant (no LibreOffice).
package chromium
+14
View File
@@ -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"
)
+3
View File
@@ -0,0 +1,3 @@
// Package libreoffice imports the application's modules for the
// LibreOffice-only variant (no Chromium).
package libreoffice
+16
View File
@@ -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"
)