This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/server/Dockerfile
2026-02-23 01:57:28 +00:00

39 lines
971 B
Docker

# ==========================================
# 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
ARG APP_VERSION=dev
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 -X main.Version=${APP_VERSION}" -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
COPY --from=builder /app/database/migrations /app/database/migrations
WORKDIR /app
EXPOSE 8080
ENTRYPOINT ["switchboard"]