mirror of
https://github.com/tiennm99/260404.git
synced 2026-06-09 20:12:20 +00:00
4c56a23e58
Implement a real-time game server using protobuf over WebSocket: - Protobuf schema with 14 message types in oneof Envelope - Room-based lobby with join/leave/chat broadcast - ELO-based matchmaking with expanding range (±100 to ±500) - Turn-based game session lifecycle management - Multi-stage Docker build (Alpine) - Unit tests for matchmaking and game session logic
14 lines
296 B
Docker
14 lines
296 B
Docker
FROM golang:1.22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /server ./cmd/server
|
|
|
|
FROM alpine:3.20
|
|
RUN apk add --no-cache ca-certificates
|
|
COPY --from=builder /server /server
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/server"]
|