13 lines
345 B
Docker
13 lines
345 B
Docker
FROM golang:1.23-alpine AS build
|
|
WORKDIR /src
|
|
COPY go.mod go.sum* ./
|
|
RUN go mod download
|
|
COPY . .
|
|
ARG SERVICE=api
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/service ./cmd/${SERVICE}
|
|
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
COPY --from=build /out/service /service
|
|
USER nonroot:nonroot
|
|
ENTRYPOINT ["/service"]
|