Feat v0.3.8 distribution (#21)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m35s
CI/CD / test-sqlite (push) Successful in 2m45s
CI/CD / build-and-deploy (push) Successful in 30s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #21.
This commit is contained in:
2026-03-28 22:46:40 +00:00
committed by xcaliber
parent d91ec02dd7
commit 310048b7bb
17 changed files with 944 additions and 11 deletions

65
Dockerfile.builder Normal file
View File

@@ -0,0 +1,65 @@
# ============================================
# 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"