All checks were successful
CI/CD / detect-changes (pull_request) Successful in 19s
CI/CD / test-frontend (pull_request) Successful in 5s
CI/CD / test-go-pg (pull_request) Successful in 2m50s
CI/CD / test-sqlite (pull_request) Successful in 3m1s
CI/CD / build-and-deploy (pull_request) Successful in 1m31s
Bundled packages auto-install on first boot for zero-config first run. Builder image for faster custom builds. Per-environment allowlists for K8s/Helm (dev=all, test=all, prod=skip). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
66 lines
2.3 KiB
Ruby
66 lines
2.3 KiB
Ruby
# ============================================
|
|
# Switchboard Core — Builder Image
|
|
# ============================================
|
|
# Pre-caches Go modules and Node dependencies
|
|
# for faster custom builds. Use as a base in
|
|
# your own Dockerfile to skip dependency
|
|
# download on every build.
|
|
#
|
|
# Usage:
|
|
# FROM ghcr.io/switchboard-core/builder:latest AS go-builder
|
|
# COPY server/ /app/
|
|
# RUN cd /app && go build -o /bin/switchboard .
|
|
#
|
|
# Or build this image locally:
|
|
# docker build -f Dockerfile.builder -t switchboard-builder .
|
|
# ============================================
|
|
|
|
# ── Go module cache ─────────────────────────
|
|
FROM golang:1.23-bookworm AS go-cache
|
|
WORKDIR /cache
|
|
COPY server/go.mod server/go.sum* ./
|
|
RUN go mod download && go mod verify
|
|
|
|
# ── Node dependency cache ───────────────────
|
|
FROM node:20-alpine AS node-cache
|
|
WORKDIR /cache
|
|
|
|
# Editor bundle dependencies
|
|
COPY src/editor/package*.json ./editor/
|
|
RUN cd editor && npm ci --loglevel=warn
|
|
|
|
# Vendor libs (same versions as production Dockerfile)
|
|
RUN npm pack marked@16.3.0 && \
|
|
npm pack dompurify@3.2.4 && \
|
|
npm pack mermaid@11.4.1 && \
|
|
npm pack katex@0.16.11 && \
|
|
mkdir -p /cache/vendor-tarballs && \
|
|
mv *.tgz /cache/vendor-tarballs/
|
|
|
|
# ── Final builder image ────────────────────
|
|
FROM golang:1.23-bookworm
|
|
|
|
# Pre-install build tools
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
zip \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Go module cache (populated)
|
|
COPY --from=go-cache /go/pkg/mod /go/pkg/mod
|
|
|
|
# Node dependencies (for editor bundle builds)
|
|
COPY --from=node-cache /cache/editor/node_modules /cache/editor/node_modules
|
|
|
|
# Vendor lib tarballs (avoid re-download)
|
|
COPY --from=node-cache /cache/vendor-tarballs /cache/vendor-tarballs
|
|
|
|
# Node.js for frontend builds
|
|
COPY --from=node-cache /usr/local/bin/node /usr/local/bin/node
|
|
COPY --from=node-cache /usr/local/lib/node_modules /usr/local/lib/node_modules
|
|
RUN ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
|
|
|
|
WORKDIR /build
|
|
|
|
LABEL org.opencontainers.image.title="Switchboard Core Builder"
|
|
LABEL org.opencontainers.image.description="Pre-cached build dependencies for faster custom Switchboard Core builds"
|