chore: shorten verbose block comments across SaaS branch

This commit is contained in:
Anthony Stirling
2026-06-08 18:38:00 +01:00
parent 8b2baaf0a0
commit 1d5ce8a1d2
12 changed files with 24 additions and 159 deletions
+2 -13
View File
@@ -1,14 +1,4 @@
# Stirling-PDF - Backend-only version (no embedded frontend)
#
# Identical to docker/embedded/Dockerfile except the JAR is built with
# -PbuildWithFrontend=false, so the React UI is NOT baked in. The gradle build
# then swaps in the lightweight API landing page (see app/core/build.gradle
# copyApiLandingPage). Use this for the split frontend/backend deployments
# (e.g. SaaS) where the UI ships as its own image (docker/frontend/Dockerfile).
#
# Because no frontend is built, the Node.js + go-task tooling that the embedded
# image installs is intentionally omitted here — the only frontend gradle tasks
# (npmInstall / npmBuild) are gated on buildWithFrontend and stay disabled.
# Stirling-PDF backend-only image — JAR built with -PbuildWithFrontend=false, UI ships separately.
ARG BASE_VERSION=1.0.2
ARG BASE_IMAGE=stirlingtools/stirling-pdf-base:${BASE_VERSION}
@@ -89,8 +79,7 @@ RUN set -eux; \
chmod 750 /tmp/stirling-pdf/heap_dumps; \
fc-cache -f
# Write version to a file so it is readable by scripts without env-var inheritance.
# init-without-ocr.sh reads /etc/stirling_version for the AOT cache fingerprint.
# Version file for scripts (init-without-ocr.sh reads /etc/stirling_version).
RUN echo "${VERSION_TAG:-dev}" > /etc/stirling_version
# Environment variables
+7 -37
View File
@@ -1,74 +1,44 @@
# check=skip=SecretsUsedInArgOrEnv
# The only ARG the SecretsUsedInArgOrEnv rule flags here is the Supabase
# PUBLISHABLE key — a client-safe value embedded in the bundle by design, not a
# secret. No real secrets are passed via ARG/ENV in this image.
# Supabase publishable ARG is client-safe by design, not a real secret.
# Frontend Dockerfile - React/Vite application
# Stage 1: build
FROM node:25-alpine@sha256:e80397b81fa93888b5f855e8bef37d9b18d3c5eb38b8731fc23d6d878647340f AS build
WORKDIR /app
# Copy package files
COPY frontend/package.json frontend/package-lock.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY frontend .
# Generate the material-symbols icon subset that LocalIcon.tsx imports at build
# time. Normally produced by `task frontend:build:<mode>` via its prepare:icons
# dependency; since this Dockerfile invokes vite directly, run it explicitly.
# Fully offline — reads the @iconify-json/material-symbols dev dependency.
# Generate material-symbols icon subset (normally done by task prepare:icons).
RUN node editor/scripts/generate-icons.js
# ---- Build configuration (backward compatible) ----
# STIRLING_FLAVOR selects the editor tsconfig + source set (see
# frontend/editor/vite.config.ts). VITE_BUILD_MODE selects which .env.<mode>
# files vite loads and is passed to `vite build --mode`. The defaults below
# reproduce the previous behaviour exactly: proprietary flavor, production mode
# (vite's implicit default for `vite build`).
#
# VITE_SUPABASE_URL + VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY are CLIENT-SAFE
# publishable values, NOT secrets. They are intentionally empty here so the OSS
# repo ships no injected config; a downstream pipeline (e.g. SaaS) passes the
# target project's publishable values as build args. Note: .env* is excluded by
# .dockerignore, so these args are the only way Supabase config reaches the
# bundle in a Docker build. vite's loadEnv merges (and prioritises) VITE_-
# prefixed process env vars, so exporting them before `vite build` is enough.
# Defaults match prior behaviour. Supabase values are client-publishable build args.
ARG STIRLING_FLAVOR=proprietary
ARG VITE_BUILD_MODE=production
ARG VITE_SUPABASE_URL=""
# pragma: allowlist secret — Supabase publishable key (safe for client)
# pragma: allowlist secret
ARG VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY=""
# Build the application (vite root is editor/, output lands in editor/dist/).
# Only export the Supabase overrides when provided so unset stays unset.
# Build vite from editor/, output lands in editor/dist/.
RUN set -eu; \
export STIRLING_FLAVOR="${STIRLING_FLAVOR}"; \
if [ -n "${VITE_SUPABASE_URL}" ]; then export VITE_SUPABASE_URL="${VITE_SUPABASE_URL}"; fi; \
if [ -n "${VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY}" ]; then export VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY="${VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY}"; fi; \
npx vite build editor --mode "${VITE_BUILD_MODE}"
# Production stage
# Stage 2: nginx
FROM nginx:alpine@sha256:b0f7830b6bfaa1258f45d94c240ab668ced1b3651c8a222aefe6683447c7bf55
# Copy built files from build stage
COPY --from=build /app/editor/dist /usr/share/nginx/html
# Copy nginx configuration and entrypoint
COPY docker/frontend/nginx.conf /etc/nginx/nginx.conf
COPY docker/frontend/entrypoint.sh /entrypoint.sh
# Make entrypoint executable
RUN chmod +x /entrypoint.sh
# Expose port 80 (standard HTTP port)
EXPOSE 80
# Environment variables for flexibility
ENV VITE_API_BASE_URL=http://backend:8080
# Use custom entrypoint
ENTRYPOINT ["/entrypoint.sh"]