# Stage 1: Build FROM golang:alpine AS builder WORKDIR /build COPY tolchain/ ./tolchain/ COPY a301_server/ ./a301_server/ WORKDIR /build/a301_server RUN go mod download RUN CGO_ENABLED=0 GOOS=linux go build -o server . # Stage 2: Run FROM alpine:latest RUN apk --no-cache add tzdata ca-certificates curl RUN mkdir -p /data/game WORKDIR /app COPY --from=builder /build/a301_server/server . EXPOSE 8080 HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD curl -f http://localhost:8080/health || exit 1 CMD ["./server"]