-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (21 loc) · 701 Bytes
/
Dockerfile
File metadata and controls
28 lines (21 loc) · 701 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
# syntax=docker/dockerfile:1.7
# --- Build stage ---
FROM golang:1.25.5-bookworm AS builder
ENV GOPROXY=https://goproxy.io,direct
ENV GOSUMDB=sum.golang.org
WORKDIR /src
# Enable Go modules and download deps first for better caching
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the source
COPY . .
# Build the API binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /out/sms-gateway ./cmd/api
# --- Runtime stage ---
FROM alpine:edge AS runner
WORKDIR /app
# Copy binary and required runtime assets (DB schema for migrations)
COPY --from=builder /out/sms-gateway /usr/local/bin/sms-gateway
COPY db/db.sql db/db.sql
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/sms-gateway"]