Ersetzt die 1900-Zeilen-Vanilla-SPA durch eine strukturierte React-App: - frontend/src: views/ (9 Views), components/ (Modals, LineChart, Heatmap, TabBar, Media, Stepper, RestTimer, Toast), store/ (Zustand: State+Sync, UI), lib/ (format, history, exercises, api/WebAuthn, sound, nav) - React Router (Hash), Zustand-Store mit localStorage + Server-Sync - Reaktives DOM-Diffing löst das manuelle Re-Render-Ruckeln (GIF läuft beim Set-Abhaken flüssig weiter) Self-Hosting bleibt ein Befehl: web/ ist jetzt ein Multi-Stage-Dockerfile, das das Frontend IM Container baut und mit nginx ausliefert — keine lokale Node/Build-Kette nötig. Übungsmedien nach ./media ausgelagert. Voller Ablauf im Headless-Browser getestet (Login→Plan→Workout→Stats→ Library→Settings, Feature-Parität) und Standalone-Compose Ende-zu-Ende (React-Build im Docker, /api-Proxy, geforgter Passkey-Login) verifiziert.
52 lines
1.7 KiB
YAML
52 lines
1.7 KiB
YAML
name: opengym
|
|
|
|
services:
|
|
# One-time: download the exercise images + GIFs into ./media (skipped if already there).
|
|
# ~140 MB, from github.com/hasaneyldrm/exercises-dataset (CC).
|
|
media:
|
|
image: alpine/git
|
|
volumes:
|
|
- ./media/img:/out/img
|
|
- ./media/gif:/out/gif
|
|
entrypoint: ["/bin/sh", "-c"]
|
|
command:
|
|
- |
|
|
if [ -z "$$(ls -A /out/img 2>/dev/null)" ]; then
|
|
echo "↓ Downloading exercise media (~140 MB, one time)…"
|
|
git clone --depth 1 https://github.com/hasaneyldrm/exercises-dataset /tmp/ds
|
|
cp /tmp/ds/images/*.jpg /out/img/ && cp /tmp/ds/videos/*.gif /out/gif/
|
|
echo "✓ Exercise media ready ($$(ls /out/img | wc -l) images)."
|
|
else
|
|
echo "✓ Exercise media already present — skipping download."
|
|
fi
|
|
restart: "no"
|
|
|
|
# Passkey auth + per-user data (Node, no framework).
|
|
api:
|
|
build: ./api
|
|
restart: unless-stopped
|
|
env_file: .env
|
|
environment:
|
|
- PORT=3000 # internal port (nginx proxies here) — do not change
|
|
- DATA_DIR=/data
|
|
volumes:
|
|
- ./data:/data # users, passkeys, per-user state, session secret — BACK THIS UP
|
|
|
|
# Builds the React frontend (multi-stage) and serves it, proxying /api → api
|
|
# and the exercise media from the shared volume. Single origin for passkeys.
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: web/Dockerfile
|
|
restart: unless-stopped
|
|
depends_on:
|
|
media:
|
|
condition: service_completed_successfully
|
|
api:
|
|
condition: service_started
|
|
ports:
|
|
- "${WEB_PORT:-8080}:80"
|
|
volumes:
|
|
- ./media/img:/usr/share/nginx/html/img:ro
|
|
- ./media/gif:/usr/share/nginx/html/gif:ro
|