saveinmed/backend/Dockerfile
Gabbriiel 90467db1ec refactor: substitui backend Medusa por backend Go e corrige testes do marketplace
- Remove backend Medusa.js (TypeScript) e substitui pelo backend Go (saveinmed-performance-core)
- Corrige testes auth.test.ts: alinha paths de API (v1/ sem barra inicial) e campo access_token
- Corrige GroupedProductCard.test.tsx: ajusta distância formatada (toFixed) e troca userEvent por fireEvent com fakeTimers
- Corrige AuthContext.test.tsx: usa vi.hoisted() para mocks e corrige parênteses no waitFor

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 04:56:37 -06: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"]