mirror of
https://github.com/tiennm99/gomoku.git
synced 2026-05-14 04:58:38 +00:00
b2be88597c
- 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)
23 lines
598 B
Docker
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"]
|