Custom conditions (per-campaign freeform) previously only persisted to the
campaign palette — Add button did NOT apply them to the targeted participant,
and badges rendered via CONDITIONS (missing custom ids) so applied custom
conditions did not display. Now:
- addCustomCondition(label, participantId) persists to palette AND toggles
onto the participant in one step. Enter + Add button both pass p.id.
- Admin badge lookup uses allConditions (built-ins + custom), not CONDITIONS.
Shared contract: toggleCondition accepts ANY string. Prove it in tests:
- turn.combat.test.js adds CUSTOM_CONDITIONS ('hexed','rager',
'marked_for_death','🛡️blessed') to the seeded queue + random pool, asserts
condition-not-string invariant, and a dedicated add/remove round-trip test.
- replay-combat.js mirrors the same CUSTOM_CONDITIONS through the live backend.
Server-mode docs/env: REACT_APP_BACKEND_WS (stale pre-rename) -> correct
REACT_APP_BACKEND_REALTIME_URL=ws://.../ws in README, env.example,
docker/Dockerfile (STORAGE=ws -> server). DEVELOPMENT.md + scripts/README.md
now point to ./scripts/dev-start.sh as the primary dev entrypoint.
133 shared tests green.
55 lines
1.6 KiB
Docker
55 lines
1.6 KiB
Docker
# docker/Dockerfile — single container: caddy (front) + node (back).
|
|
# Build context = repo root.
|
|
# ---- build stage: frontend + install backend deps ----
|
|
FROM node:18-alpine AS build
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
COPY shared/package.json ./shared/
|
|
COPY server/package.json ./server/
|
|
RUN npm install --include-workspace-root
|
|
|
|
COPY shared/ ./shared/
|
|
COPY server/ ./server/
|
|
COPY src/ ./src/
|
|
COPY public/ ./public/
|
|
COPY tailwind.config.js postcss.config.js ./
|
|
|
|
# better-sqlite3 native build (alpine musl)
|
|
RUN cd server && npm rebuild better-sqlite3
|
|
|
|
# build frontend (server storage, same-origin /api + /ws via caddy)
|
|
ARG REACT_APP_TRACKER_APP_ID=ttrpg-initiative-tracker-default
|
|
ENV REACT_APP_STORAGE=server
|
|
ENV REACT_APP_TRACKER_APP_ID=$REACT_APP_TRACKER_APP_ID
|
|
RUN NODE_OPTIONS=--openssl-legacy-provider npm run build
|
|
|
|
# prune backend dev deps for runtime
|
|
RUN npm prune --omit=dev
|
|
|
|
# ---- runtime stage: caddy + node ----
|
|
FROM node:18-alpine
|
|
RUN apk add --no-cache caddy
|
|
|
|
WORKDIR /app
|
|
COPY --from=build /app/node_modules ./node_modules
|
|
COPY --from=build /app/shared/node_modules ./shared/node_modules
|
|
COPY --from=build /app/server/node_modules ./server/node_modules
|
|
COPY --from=build /app/package*.json ./
|
|
COPY --from=build /app/shared/package.json ./shared/
|
|
COPY --from=build /app/server/package.json ./server/
|
|
COPY shared/ ./shared/
|
|
COPY server/ ./server/
|
|
# built frontend served by caddy
|
|
COPY --from=build /app/build /srv
|
|
COPY docker/Caddyfile /etc/caddy/Caddyfile
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=4001
|
|
ENV DB_PATH=/data/tracker.sqlite
|
|
|
|
EXPOSE 80
|
|
WORKDIR /app
|
|
CMD ["/entrypoint.sh"]
|