25 lines
760 B
Docker
25 lines
760 B
Docker
FROM node:24-bookworm-slim AS client
|
|
WORKDIR /src
|
|
COPY package*.json ./
|
|
RUN npm ci --no-fund
|
|
COPY schemas ./schemas
|
|
COPY tools/generate-protocol.mjs ./tools/generate-protocol.mjs
|
|
COPY client ./client
|
|
COPY server/internal/protocol ./server/internal/protocol
|
|
RUN npm run test:contracts && npm run check && npm run build
|
|
|
|
FROM golang:1.27.1-bookworm AS server
|
|
WORKDIR /src
|
|
COPY server/go.mod server/go.sum ./
|
|
RUN go mod download
|
|
COPY server ./
|
|
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /world ./cmd/world
|
|
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
COPY --from=server /world /world
|
|
COPY --from=client /src/client/dist /client
|
|
ENV APP_ENV=production LISTEN_ADDR=0.0.0.0:8080 CLIENT_DIR=/client
|
|
USER 65532:65532
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/world"]
|