mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 11:02:54 +00:00
- Create multi-stage Dockerfile for CLI application - Use golang:1.26-alpine as builder image - Copy go.mod and go.sum for dependency caching - Build static binary with CGO_ENABLED=0 - Use alpine:latest as runtime image with ca-certificates - Set /root/ as working directory and ./cli as default command
21 lines
300 B
Docker
21 lines
300 B
Docker
FROM golang:1.26-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY apps/cli/go.mod apps/cli/go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY apps/cli/ ./
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o cli .
|
|
|
|
FROM alpine:latest
|
|
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
WORKDIR /root/
|
|
|
|
COPY --from=builder /app/cli .
|
|
|
|
CMD ["./cli"]
|