Files
shop-go/Dockerfile
T

30 lines
431 B
Docker

# Build stage
FROM golang:1.23-alpine AS builder
WORKDIR /app
RUN apk add --no-cache ca-certificates git
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /shop ./cmd/shop
# Runtime stage
FROM alpine:3.21
RUN apk add --no-cache ca-certificates tzdata
ENV TZ=UTC
WORKDIR /app
COPY --from=builder /shop /app/shop
EXPOSE 8080
USER nobody
ENTRYPOINT ["/app/shop"]