Reconstructed from /root/briggen-dev/ttrpg — the tree the running prod
container was composed from. Forked from 235cdec (2026-06-08); adds 3D
dice + themes, extended dice notation, session replay, route-level code
splitting, and more.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
27 lines
1.0 KiB
Docker
27 lines
1.0 KiB
Docker
# --- build stage: bundle the PWA + the realtime server ---
|
|
FROM oven/bun:1 AS build
|
|
WORKDIR /app
|
|
COPY package.json bun.lock* bun.lockb* ./
|
|
RUN bun install
|
|
COPY . .
|
|
RUN bun run build # tsc -b && vite build → /app/dist
|
|
RUN bun run build:server # esbuild → /app/server/dist/index.js
|
|
|
|
# --- runtime stage: bun image, non-root, serves dist + /ws ---
|
|
# bun (not node:20) because the server now persists via the built-in `bun:sqlite`
|
|
# driver (T-129); node:20 has neither bun:sqlite nor node:sqlite (node ≥22.5), so
|
|
# the container would crash on startup. The bundle is run with `bun`.
|
|
FROM oven/bun:1 AS runtime
|
|
ENV NODE_ENV=production STATIC_DIR=/app/dist PORT=8787
|
|
WORKDIR /app/server
|
|
COPY server/package.json ./
|
|
RUN bun install --production
|
|
COPY --from=build /app/server/dist ./dist
|
|
COPY --from=build /app/dist /app/dist
|
|
# Cloud-sync data dir; create it bun-owned so a fresh named volume mounts writable.
|
|
ENV DATA_DIR=/data
|
|
RUN mkdir -p /data && chown -R bun:bun /app /data
|
|
USER bun
|
|
EXPOSE 8787
|
|
CMD ["bun", "dist/index.js"]
|