-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (24 loc) · 1.26 KB
/
Dockerfile
File metadata and controls
32 lines (24 loc) · 1.26 KB
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
# syntax=docker/dockerfile:1
# Build any dispatch service:
# docker build --build-arg SERVICE=mail-gateway -t dispatch/mail-gateway .
# docker build --build-arg SERVICE=mail-worker -t dispatch/mail-worker .
# docker build --build-arg SERVICE=mail-admin -t dispatch/mail-admin .
# docker build --build-arg SERVICE=bouncemanagement -t dispatch/bouncemanagement .
ARG SERVICE=mail-gateway
ARG VERSION=0.5.0
# ── Builder ───────────────────────────────────────────────────────────────────
FROM golang:1.25-alpine AS builder
ARG SERVICE
ARG VERSION
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -trimpath -ldflags="-s -w -X dispatch/internal/version.Version=${VERSION}" \
-o /bin/service ./cmd/${SERVICE}
# ── Runtime ───────────────────────────────────────────────────────────────────
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=builder /bin/service /service
USER nonroot:nonroot
ENTRYPOINT ["/service"]