saveinmed/backend/Dockerfile
Tiago Yamamoto 5c59e7b5a1 docs: add DEVOPS guide and optimize Dockerfiles
- Add DEVOPS.md with complete deployment guide for apolo server
- Add DATABASE.md (unified schema documentation)
- Fix backend Dockerfile: Go 1.24 -> 1.23 (current stable)
- Add marketplace Dockerfile with pnpm + static-web-server
- Migrate marketplace from npm to pnpm
- Remove duplicate database-schema.md and DATABASE_SCHEMA.md
2025-12-29 17:00:42 -03:00

31 lines
757 B
Docker

# syntax=docker/dockerfile:1
# ===== STAGE 1: Build =====
FROM golang:1.23-alpine AS builder
WORKDIR /build
# Cache de dependências - só rebuild se go.mod/go.sum mudar
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download && go mod verify
# Copia código fonte
COPY . .
# Build otimizado com cache
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -trimpath -ldflags="-s -w" \
-o /app/server ./cmd/api
# ===== STAGE 2: Runtime (distroless - segurança + mínimo ~2MB) =====
FROM gcr.io/distroless/static-debian12:nonroot
# Binary
COPY --from=builder /app/server /server
EXPOSE 8214
ENTRYPOINT ["/server"]