13 lines
423 B
Docker
13 lines
423 B
Docker
FROM golang:1.25-bookworm AS builder
|
|
WORKDIR /app
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
# Buildx automatically injects TARGETARCH, TARGETOS, and TARGETPLATFORM as build args into the Dockerfile
|
|
ARG TARGETARCH
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o go-weather .
|
|
FROM gcr.io/distroless/static-debian12
|
|
COPY --from=builder /app/go-weather /go-weather
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/go-weather"]
|