# ========================================== # Chat Switchboard - Backend Dockerfile # ========================================== # Standalone Go API server for cluster deployment. # Build context is ./server (not repo root). # ========================================== # Build stage FROM golang:1.22-bookworm AS builder WORKDIR /app # Copy module files and download deps COPY go.mod go.sum* ./ RUN go mod download # Copy source and tidy (resolves any go.sum gaps) COPY . . RUN go mod tidy RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /bin/switchboard . # Runtime stage FROM debian:bookworm-slim RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ && rm -rf /var/lib/apt/lists/* COPY --from=builder /bin/switchboard /usr/local/bin/switchboard EXPOSE 8080 ENTRYPOINT ["switchboard"]