Files
bot-pontos/backend/Dockerfile
2026-10-23 22:31:02 -03:00

23 lines
687 B
Docker

# syntax=docker/dockerfile:1
# ---- build ----
FROM golang:1.25-alpine AS build
WORKDIR /src
COPY go.mod go.sum* ./
RUN if [ -f go.sum ]; then go mod download; fi
COPY . .
ARG VERSION=dev
# Enquanto o go.sum não existir no repositório, ele é gerado aqui (ver README).
RUN if [ ! -f go.sum ]; then go mod tidy; fi \
&& CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X main.version=${VERSION}" \
-o /out/botpontos ./cmd/botpontos
# ---- runtime ----
# distroless/static: sem shell, sem gerenciador de pacotes, usuário não-root.
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/botpontos /botpontos
USER nonroot:nonroot
ENTRYPOINT ["/botpontos"]