-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (19 loc) · 965 Bytes
/
Copy pathDockerfile
File metadata and controls
28 lines (19 loc) · 965 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
# ── Build stage ───────────────────────────────────────────────────────────────
FROM golang:1.22-alpine AS builder
WORKDIR /app
# Copy dependency manifests first for layer caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source and build
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /notification-service ./cmd/server
# ── Runtime stage ─────────────────────────────────────────────────────────────
FROM alpine:3.19
# Install ca-certificates for HTTPS calls to AWS
RUN apk add --no-cache ca-certificates
WORKDIR /app
# Copy binary and migrations
COPY --from=builder /notification-service .
COPY migrations/ migrations/
EXPOSE 8080
ENTRYPOINT ["./notification-service"]