-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.local
More file actions
35 lines (27 loc) · 795 Bytes
/
Dockerfile.local
File metadata and controls
35 lines (27 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Build stage
FROM golang:1.23.3-alpine3.20 AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache git
# Copy only dependency files first for better caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build with optimizations
ENV CGO_ENABLED=0 \
GOOS=linux
RUN go build -ldflags="-w -s" -o app cmd/server/main.go
# Final stage
FROM ghcr.io/typst/typst:v0.13.1 AS typst
FROM alpine:3.20
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
COPY --from=builder /app/app .
COPY --from=builder /app/internal/config ./config
COPY --from=builder /app/assets/fonts ./assets/fonts
COPY --from=builder /app/assets/typst-templates ./assets/typst-templates
COPY --from=typst /bin/typst /usr/local/bin/
ENV TZ=UTC
EXPOSE 8080
CMD ["./app"]