Files
cup26/Dockerfile
T
NilsBriggen 716dab2f23 Quick backtest mode for image builds (identical published numbers)
BACKTEST_QUICK=1 skips the hyperparameter grid and scores only the
shipped + previous configs — same test metrics, a fraction of the
build time on the 1-CPU VPS. The full grid search stays a local
activity. Verified byte-level: quick output matches the grid run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 00:33:42 +02:00

27 lines
1.1 KiB
Docker

# --- build stage: generate data, bundle the PWA + the live server ---
FROM oven/bun:1 AS build
WORKDIR /app
COPY package.json bun.lock* bun.lockb* ./
RUN bun install
COPY . .
# Quick backtest in image builds: score the shipped config only — the published
# numbers are identical; the hyperparam grid search is a local-dev activity.
ENV BACKTEST_QUICK=1
RUN bun run data:build # icons + fixtures.json + ratings.json + backtest → public/
RUN bun run build # tsc -b && vite build → /app/dist
RUN bun run build:server # esbuild → /app/server/dist/index.js
# --- runtime stage: node 24 (built-in node:sqlite), non-root, serves dist + /ws + /api ---
FROM node:24-slim AS runtime
ENV NODE_ENV=production STATIC_DIR=/app/dist PORT=8787 DATA_DIR=/data
WORKDIR /app/server
COPY server/package.json ./
RUN npm install --omit=dev --no-audit --no-fund
COPY --from=build /app/server/dist ./dist
COPY --from=build /app/dist /app/dist
# SQLite lives on a named volume; create it node-owned so a fresh mount is writable.
RUN mkdir -p /data && chown -R node:node /app /data
USER node
EXPOSE 8787
CMD ["node", "--experimental-sqlite", "dist/index.js"]