Files
zeekayandClaude Opus 4.8 43c689503a feat(gallery): canonical templates.json catalog API (SoT -> build-time gen)
Emit public/templates.json from app/templates-data.ts (the single source of
truth) via a prebuild step, so gallery.hanzo.ai/templates.json is the
machine-readable template catalog consumed by hanzo.app. Each record keeps
the raw SoT fields and adds absolute screenshotUrl/templateUrl/repo so
consumers never encode the gallery's internal path scheme.

- scripts/gen-templates-json.mjs: imports templates-data.ts (node 24 type-strip)
- package.json: prebuild hook runs the generator before next build
- Dockerfile: node:22 -> node:24 for stable TS type-stripping
- public/templates.json: 72 templates, 71 with real screenshots

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 22:09:17 -07:00

26 lines
1.2 KiB
Docker

# gallery.hanzo.ai — the Hanzo template gallery (72 real templates).
# Next.js static export (output: 'export') served by hanzoai/static — NOT nginx.
# Two stages: build the export, then re-serve it through the canonical static server.
# 1) Build the Next.js static export -> /app/out
# node:24 (LTS) has stable TypeScript type-stripping so the `prebuild` step can
# `import` app/templates-data.ts directly to emit public/templates.json (the SoT
# -> canonical catalog API). No flags needed.
FROM node:24-bookworm-slim AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY . .
# next.config.ts sets output:'export'; produces /app/out. Turbopack build can be
# flaky in CI containers, so build with the stable webpack builder.
ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build
# 2) Serve the static export with hanzoai/static. --spa rewrites unknown routes
# to index.html (client routing); :3000 is the static default, and the
# gallery-site Service maps servicePort 80 -> targetPort 3000.
FROM ghcr.io/hanzoai/static:0.4.1
COPY --from=build /app/out /srv
EXPOSE 3000
ENTRYPOINT ["/static", "--root=/srv", "--spa", "--port=3000"]