-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (26 loc) · 861 Bytes
/
Copy pathDockerfile
File metadata and controls
29 lines (26 loc) · 861 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
# Build the frontend, embed it into the Go binary, ship a tiny static image.
# 1. frontend
FROM node:20-alpine AS web
WORKDIR /src/web
COPY web/package.json web/package-lock.json* ./
RUN npm install
COPY web/ ./
RUN npm run build
# 2. server (embeds web/dist via go:embed)
FROM golang:1.25-alpine AS server
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=web /src/web/dist ./web/dist
# CGO off keeps it a static binary; modernc sqlite is pure Go so this is fine.
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /redpaste-server ./cmd/redpaste-server
# 3. runtime
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=server /redpaste-server /redpaste-server
EXPOSE 8080
USER nonroot:nonroot
ENV REDPASTE_LISTEN_ADDR=:8080 \
REDPASTE_SQLITE_PATH=/data/redpaste.db
VOLUME ["/data"]
ENTRYPOINT ["/redpaste-server"]