Files

47 lines
951 B
Docker
Raw Permalink Normal View History

2025-08-14 23:25:01 +02:00
# =========== 1) Build stage ===========
2025-12-26 08:45:47 +01:00
FROM golang:1.25-alpine AS builder
2025-08-14 23:25:01 +02:00
# Install necessary packages for CGO and SQLite
RUN apk add --no-cache gcc musl-dev sqlite-dev
WORKDIR /app
# Copy go.mod and go.sum first
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the backend code
COPY . .
# Build the Go binary
RUN go build -v -o server cmd/main.go
# =========== 2) Runtime stage ===========
2025-12-26 08:45:47 +01:00
FROM alpine:3.23
# Install Chromium for PDF rendering
RUN apk add --no-cache \
chromium \
chromium-chromedriver \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont
# Set Chrome path for chromedp
ENV CHROME_BIN=/usr/bin/chromium-browser \
CHROME_PATH=/usr/bin/chromium-browser
2025-08-14 23:25:01 +02:00
WORKDIR /app
# Copy the compiled binary from builder stage
COPY --from=builder /app/server /app
2025-12-27 08:27:34 +01:00
COPY --from=builder /app/templates /app/default_templates
2025-08-14 23:25:01 +02:00
# Expose port
EXPOSE 8180
# Run the Go server
CMD ["./server"]