-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
74 lines (72 loc) · 3.13 KB
/
Copy pathdocker-compose.yml
File metadata and controls
74 lines (72 loc) · 3.13 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
services:
db:
image: postgres:16
container_name: postgres__training-api
environment:
POSTGRES_DB: ${POSTGRES_DB:-training-api}
POSTGRES_USER: ${POSTGRES_USER:-training-api}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-training-api}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-training-api}"]
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
app:
# Prebuilt multi-arch image (amd64/arm64), published by CI. `pull_policy:
# missing` makes a fresh install pull it instead of building from source;
# `docker compose build` (or `up --build`) still builds locally from the
# same Dockerfile and is the fallback when the pull fails. Pin a release
# with IMAGE_TAG in .env (see README "Releases & upgrading").
image: ghcr.io/aderaaij/loopback-training-server:${IMAGE_TAG:-latest}
pull_policy: missing
build:
context: .
dockerfile: backend/Dockerfile
container_name: backend__training-api
ports:
- "${API_PORT:-8001}:8001"
depends_on:
db:
condition: service_healthy
# Optional extra app config (also used when running the backend outside
# Docker). A containerized install needs no file here: everything below is
# derived from this compose file's own variables (see .env.example).
env_file:
- path: ./backend/config/.env
required: false
environment:
# Derived from the same POSTGRES_* variables as the db service, so the
# two can never drift. Point at an external database instead via a
# docker-compose.override.yml.
- DATABASE_URL=postgresql+psycopg://${POSTGRES_USER:-training-api}:${POSTGRES_PASSWORD:-training-api}@db:5432/${POSTGRES_DB:-training-api}
# Run `fastapi run` (production), not the `fastapi dev` file-watcher
# (see backend/scripts/start.sh).
- ENVIRONMENT=PRODUCTION
- BACKUP_DIR=/backups
# Server-managed backups (nightly pg_dump + pre-migration dump). These
# pass through only when set in the root .env; defaults are enabled,
# 03:30 container time, keep 30. TZ makes BACKUP_TIME local time.
- BACKUP_ENABLED
- BACKUP_TIME
- BACKUP_KEEP
- TZ
# First-run admin account (password applied only while the admin has
# none — see README "Quick Start"). Set these in the root .env: they pass
# through from there, and when unset the variables are absent in the
# container — which also masks any BOOTSTRAP_* in backend/config/.env
# (that file's copies only apply to non-Docker runs).
- BOOTSTRAP_ADMIN_USERNAME
- BOOTSTRAP_ADMIN_PASSWORD
volumes:
# Backup dir: the server writes its own pg_dump files here (nightly +
# pre-migration + on demand from the System screen, which also reports
# freshness). Point it at your real backup location via BACKUP_HOST_DIR
# or a docker-compose.override.yml; add :ro and BACKUP_ENABLED=false to
# manage backups yourself.
- ${BACKUP_HOST_DIR:-./backups}:/backups
restart: unless-stopped
volumes:
postgres_data: