refactor: replace pdftoppm with go-fitz for in-process PDF rendering

Switch PDF page rendering from external pdftoppm/pdftocairo subprocess calls
to github.com/gen2brain/go-fitz (MuPDF wrapper), eliminating the poppler-utils
runtime dependency. Enable CGO in Dockerfile builder stage and install gcc/musl-dev
for the static MuPDF link; runtime image remains unchanged.
This commit is contained in:
2026-03-31 21:21:17 +08:00
parent 86dacb61a6
commit 84ce6f6b92
4 changed files with 48 additions and 90 deletions

View File

@@ -10,9 +10,10 @@ ENV GOPROXY=https://goproxy.cn,direct
ENV GOSUMDB=off
# Build binary
RUN go mod download && \
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o doc_ai ./main.go
# Build binary (CGO required for go-fitz/MuPDF)
RUN apk add --no-cache gcc musl-dev && \
go mod download && \
CGO_ENABLED=1 GOOS=linux go build -ldflags="-s -w" -o doc_ai ./main.go
# Runtime stage
FROM crpi-8s2ierii2xan4klg.cn-beijing.personal.cr.aliyuncs.com/texpixel/alpine:latest