-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (31 loc) · 949 Bytes
/
Dockerfile
File metadata and controls
43 lines (31 loc) · 949 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
36
37
38
39
40
41
42
43
# Stage 1: Build
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Install dependencies (cached)
COPY go.mod go.sum ./
RUN go mod download
# Copy source
COPY . .
# Build binaries (Static linking for Alpine)
RUN CGO_ENABLED=0 GOOS=linux go build -o postificus-api ./cmd/api/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -o postificus-worker ./cmd/worker/main.go
# -------------------------------------------------------
# Stage 2: Run (Alpine)
# -------------------------------------------------------
FROM alpine:latest
WORKDIR /app
# Install Chromium/Chrome dependencies for Rod (CRITICAL for Alpine)
RUN apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont
# Copy binaries
COPY --from=builder /app/postificus-api .
COPY --from=builder /app/postificus-worker .
# Expose API port
EXPOSE 8080
# Command is set by docker-compose (either api or worker)
CMD ["./postificus-api"]