FROM golang:1.24-alpine AS builder

WORKDIR /build
COPY server/go.mod server/go.sum ./
RUN go mod download

COPY server/ .
RUN CGO_ENABLED=0 go build -o cyberverse-server ./cmd/cyberverse-server

FROM alpine:3.21
RUN apk add --no-cache ca-certificates
WORKDIR /app
COPY --from=builder /build/cyberverse-server .
COPY cyberverse_config.yaml .

EXPOSE 8080
CMD ["./cyberverse-server", "--config", "cyberverse_config.yaml"]
