The Codex CLI adapter, its runtime and sandbox in the coach image only, and the one placement decision this PR exists to get right. Codex keeps a refreshable sign-in cache of its own rather than taking a token on the environment, so it needs somewhere durable to write. That is ./coach-auth — a sibling of ./data, never a folder inside it, mounted separately, owned by `coach`, mode 0700. The placement is the point. docs/SELF_HOSTING §5 tells owners to back up with `tar czf … data/`, so anything under ./data lands in every archive people are instructed to produce. Workout history belongs there; a live refresh token does not — it keeps working after that archive is copied to a laptop or a cloud drive. Keeping the cache outside ./data is what lets the backup instructions stay true about what they capture, and §5 now says so explicitly rather than leaving the reader to find out. I got to define this rather than fix it: no Codex path was ever committed here, so the nested layout the fork had never reached this repo. A test asserts the sibling relationship directly, because "outside ./data" is the kind of invariant a later refactor breaks by tidying. bubblewrap and the Codex CLI are added in the coach target only — bubblewrap is a Codex requirement, so an owner who never opted in carries neither. The image job now asserts both directions: present and runnable in the coach image (codex-cli 0.147.0, bubblewrap 0.11.2, /coach-auth as coach:0700), and absent from the default one. Codex is usable through the existing connect route with an API key, which needs no new surface. Its ChatGPT device-code sign-in is not in this PR — see the PR description for what that still needs. api 73/73, frontend 404/404, both image targets built and inspected, 11 locales in sync at 767, library in sync at 1324. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
66 lines
2.6 KiB
YAML
66 lines
2.6 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).
|
|
# image: prebuilt (docker compose pull). build: from source (docker compose up --build).
|
|
api:
|
|
image: ghcr.io/duartesantos8/opengym-api:latest
|
|
# Default target: no AI runtime, no AI dependency — the image every instance has always had.
|
|
# To opt into the AI Coach, build the other target instead:
|
|
# API_TARGET=coach docker compose up --build api
|
|
# `--build` matters: with an `image:` also set, compose would otherwise pull the prebuilt
|
|
# default rather than build the coach one.
|
|
build:
|
|
context: ./api
|
|
target: ${API_TARGET:-default}
|
|
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
|
|
# Provider credential cache (Codex). A sibling of ./data on purpose: the documented backup
|
|
# is `tar czf … data/`, and a live refresh token must not end up inside it. Nothing here
|
|
# needs backing up — if you lose it, sign the provider in again.
|
|
- ./coach-auth:/coach-auth
|
|
|
|
# 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:
|
|
image: ghcr.io/duartesantos8/opengym-web:latest
|
|
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
|