Projeto bot pontos
This commit is contained in:
22
backend/Dockerfile
Normal file
22
backend/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
# 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"]
|
||||
Reference in New Issue
Block a user