-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
57 lines (55 loc) · 2.76 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
57 lines (55 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Compose project name. Pins the container / network / volume / image
# prefixes to "adaptive-learner" regardless of the install directory, so
# the stack is recognizable in Docker Desktop and never collides with a
# sibling app (e.g. bibliogon) that was launched from a similarly named
# folder.
#
# Since #2058 the stack is a SINGLE service: the backend image carries the
# bun-built frontend statics and FastAPI serves them itself (SPA fallback,
# 50M body limit and gzip live as middleware - the retired nginx service's
# whole feature set). This file is the documented power-user alternative;
# the desktop launcher drives the same image through docker-py
# (deployment_mode "dockerfile") without needing Compose at all.
name: adaptive-learner
services:
app:
container_name: adaptive-learner
image: adaptive-learner
build:
context: .
dockerfile: backend/Dockerfile
# One container, one port: the host-published port the user reaches in
# the browser maps straight onto the backend port that serves BOTH the
# frontend statics and /api/*. ``ADAPTIVE_LEARNER_PUBLIC_PORT`` (default
# 8501 - Adaptive Learner's own port, NOT 7880/Bibliogon) is written
# into .env by the launcher and can move on a conflict; the internal
# port stays env-driven for experts running multiple Docker apps.
command: sh -c 'uvicorn app.main:app --host 0.0.0.0 --port ${ADAPTIVE_LEARNER_BACKEND_PORT:-8000} --workers 2'
ports:
- "${ADAPTIVE_LEARNER_PUBLIC_PORT:-8501}:${ADAPTIVE_LEARNER_BACKEND_PORT:-8000}"
volumes:
- adaptive-learner-data:/app/data
environment:
- PYTHONDONTWRITEBYTECODE=1
- ADAPTIVE_LEARNER_DEBUG=false
# Single canonical data dir. DB lives at $DATA_DIR/adaptive_learner.db
# and uploads at $DATA_DIR/uploads/, both inside the named
# volume so they survive container rebuilds. The volume mount
# at /app/data is the persistence boundary.
- ADAPTIVE_LEARNER_DATA_DIR=/app/data
- ADAPTIVE_LEARNER_PORT=${ADAPTIVE_LEARNER_BACKEND_PORT:-8000}
- ADAPTIVE_LEARNER_CORS_ORIGINS=${ADAPTIVE_LEARNER_CORS_ORIGINS:-http://localhost:${ADAPTIVE_LEARNER_PUBLIC_PORT:-8501}}
- ADAPTIVE_LEARNER_SECRET_KEY=${ADAPTIVE_LEARNER_SECRET_KEY:-}
# Serve the bundled frontend statics from the backend (#2058); both
# values are also baked into the image, repeated here for explicitness.
- ADAPTIVE_LEARNER_SERVE_FRONTEND=1
- ADAPTIVE_LEARNER_FRONTEND_DIST=/app/static
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:${ADAPTIVE_LEARNER_BACKEND_PORT:-8000}/api/health')\""]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
restart: unless-stopped
volumes:
adaptive-learner-data: