Files
galdr/Dockerfile
⓪ηηωεε忧世 351393dc16 feat: implement project foundation & infrastructure (epic #5)
- #35: Chi router with structured logging, panic recovery, request ID, graceful shutdown
- #36: golang-migrate framework with initial extensions migration
- #37: Expanded config package with server, database, CORS, rate limit settings
- #38: GitHub Actions CI pipeline for Go and React
- #39: Multi-stage Dockerfile for Go API (alpine, non-root, <30MB)
- #40: Multi-stage Dockerfile for React frontend with Nginx SPA routing
- #41: Production Docker Compose with all services and health checks
- #44: Health check endpoints (/healthz liveness, /readyz readiness)
- #45: CORS, security headers, and rate limiting middleware

Closes #35, closes #36, closes #37, closes #38, closes #39, closes #40, closes #41, closes #44, closes #45
2026-02-22 20:25:41 -06:00

38 lines
1.1 KiB
Docker

# =============================================================================
# Stage 1: Build
# =============================================================================
FROM golang:1.24-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o pulsescore-api ./cmd/api
# =============================================================================
# Stage 2: Runtime
# =============================================================================
FROM alpine:3.21
RUN apk add --no-cache ca-certificates tzdata \
&& addgroup -g 1001 -S appgroup \
&& adduser -u 1001 -S appuser -G appgroup
WORKDIR /app
COPY --from=builder /build/pulsescore-api .
COPY --from=builder /build/migrations ./migrations
USER appuser:appgroup
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD ["wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/healthz"]
ENTRYPOINT ["./pulsescore-api"]