forked from mohdTahaRafi/ResQLink
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (31 loc) · 1.05 KB
/
Copy pathDockerfile
File metadata and controls
45 lines (31 loc) · 1.05 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
33
34
35
36
37
38
39
40
41
42
43
44
45
# ============================================
# Stage 1: Build
# ============================================
FROM golang:1.22-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Build API server
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags="-s -w" \
-o /bin/resqlink-api ./cmd/api
# Build Worker
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags="-s -w" \
-o /bin/resqlink-worker ./cmd/worker
# ============================================
# Stage 2: API Runtime (<25MB)
# ============================================
FROM gcr.io/distroless/static-debian12 AS api
COPY --from=builder /bin/resqlink-api /resqlink-api
EXPOSE 8080
ENTRYPOINT ["/resqlink-api"]
# ============================================
# Stage 3: Worker Runtime (<25MB)
# ============================================
FROM gcr.io/distroless/static-debian12 AS worker
COPY --from=builder /bin/resqlink-worker /resqlink-worker
EXPOSE 8081
ENTRYPOINT ["/resqlink-worker"]