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
Jeffrey Smith ed3e9363f2 Changeset 0.33.0 (#207)
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
2026-03-19 21:37:32 +00:00

50 lines
1.5 KiB
Docker

# ==========================================
# Chat Switchboard - Backend Dockerfile
# ==========================================
# Standalone Go API server for cluster deployment.
# Build context is the repo root (not ./server).
# ==========================================
# Build stage
FROM golang:1.23-bookworm AS builder
ARG APP_VERSION=dev
WORKDIR /app
# Copy module files and download deps
COPY server/go.mod server/go.sum* ./
RUN go mod download
# Copy source and tidy (resolves any go.sum gaps)
COPY server/ .
RUN go mod tidy
# Copy VERSION from repo root — used by ldflags and copied to runtime image.
# If APP_VERSION build-arg was supplied by CI, it takes precedence via ldflags.
# If not, $(cat VERSION) reads the file directly so the binary always has a real version.
COPY VERSION ./
RUN CGO_ENABLED=0 go build -ldflags="-s -w -X main.Version=$(cat 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
# VERSION file at /VERSION — version.go init() reads it as fallback for local/dev runs
COPY --from=builder /app/VERSION /VERSION
# Builtin extensions (seeded into DB on startup)
COPY extensions/builtin/ /app/extensions/builtin/
WORKDIR /app
EXPOSE 8080
ENTRYPOINT ["switchboard"]