Files
tiennm99 b2be88597c feat(docker): multi-stage Dockerfiles and compose for server + nginx client
- server/Dockerfile: golang:1.23-alpine build → distroless/static-debian12:nonroot (3.5 MB)
- client/Dockerfile: node:22-alpine Vite build → nginx:1.27-alpine runtime
- client/nginx.conf: SPA fallback, aggressive asset caching, gzip
- docker-compose.yml: two services — server :1999, client :8080
- server/.dockerignore / client/.dockerignore: trim build contexts
- server/Makefile: add docker-build/run/stop/logs/smoke targets
- client/vite.config.js: raise chunkSizeWarningLimit to 2000 (Phaser bundle)
- remove server/docker-compose.yaml (superseded by root compose file)
2026-04-11 15:28:15 +07:00

23 lines
598 B
Docker

# syntax=docker/dockerfile:1.7
# Build stage: compile Go binary with full toolchain
FROM golang:1.23-alpine AS build
WORKDIR /src
# Cache dependency downloads separately from source code
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/gomoku-server .
# Runtime stage: minimal distroless image (no shell, no package manager)
FROM gcr.io/distroless/static-debian12:nonroot AS runtime
COPY --from=build /out/gomoku-server /gomoku-server
EXPOSE 1999
USER nonroot:nonroot
ENTRYPOINT ["/gomoku-server"]
CMD ["-p", "1999"]