FROM golang:1.22-alpine AS builder WORKDIR /src RUN apk add --no-cache git ca-certificates COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" \ -o /app/server ./cmd/server FROM alpine:3.20 RUN apk add --no-cache ca-certificates tzdata wget \ && adduser -D -u 10001 app WORKDIR /app COPY --from=builder /app/server . USER app EXPOSE 8080 HEALTHCHECK --interval=15s --timeout=5s --start-period=20s --retries=3 \ CMD wget -qO- http://127.0.0.1:8080/health || exit 1 CMD ["./server"]