### Step 1: Build stage FROM golang:1.26-alpine AS builder WORKDIR /app COPY go.mod go.sum ./ COPY internal internal COPY cmd cmd RUN apk add --no-cache musl-dev build-base && go mod download RUN CGO_ENABLED=1 CC=gcc go build -ldflags="-linkmode external -extldflags '-static'" -o go14 cmd/server/main.go ## Step 2: Runtime stage FROM scratch WORKDIR /app COPY static /app/static COPY --from=builder /app/go14 /app/go14 EXPOSE 31592 CMD ["/app/go14"]