Files
doc_ai_backed/Dockerfile
yoge 84ce6f6b92 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.
2026-03-31 21:21:17 +08:00

47 lines
1.0 KiB
Docker

# Build stage
FROM crpi-8s2ierii2xan4klg.cn-beijing.personal.cr.aliyuncs.com/texpixel/golang:1.20-alpine AS builder
WORKDIR /app
# Copy source code
COPY . .
ENV GOPROXY=https://goproxy.cn,direct
ENV GOSUMDB=off
# 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
# Set timezone
RUN apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/doc_ai .
# Copy config files
COPY config/config_*.yaml ./config/
# Create data directory
RUN mkdir -p /data/formula && \
chmod -R 755 /data
# Expose port (update based on your config)
EXPOSE 8024
# Set entrypoint
ENTRYPOINT ["./doc_ai"]
# Default command (can be overridden)
CMD ["-env", "prod"]