-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
84 lines (80 loc) · 2.59 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
84 lines (80 loc) · 2.59 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
75
76
77
78
79
80
81
82
83
84
# Dev override. Use with:
# docker compose -f docker-compose.yml -f docker-compose.dev.yml up
#
# Differences from prod:
# - api runs the api-dev target (no baked-in frontend bundle) with uvicorn
# --reload, and bind-mounts src/ so edits restart the server live.
# - frontend runs the Vite dev server on :5173 with HMR, proxying /api -> api.
# - test / test-int services run the unit and integration suites.
services:
api:
build:
context: .
target: api-dev
volumes:
- ./src:/app/src
- ./alembic:/app/alembic
# Bind-mount the cache to the host project dir so cached files are
# browsable on the local machine. Overrides the base named volume.
- ./cache:/cache
- hf_cache:/hf-cache
frontend:
image: node:20-slim
working_dir: /frontend
command: sh -c "npm install && npm run dev -- --host 0.0.0.0"
environment:
# Point Vite's /api proxy at the api service instead of localhost:8000.
VITE_API_PROXY_TARGET: http://api:8000
ports:
- "5173:5173"
volumes:
- ./frontend:/frontend
# Keep node_modules inside the container so the host platform's modules
# (e.g. macOS) don't shadow the Linux build.
- frontend_node_modules:/frontend/node_modules
depends_on:
- api
# Unit tests: no network, no DB. One-shot; run with `--profile test`.
test:
build:
context: .
target: api-dev
profiles: ["test"]
env_file:
- .env
environment:
CONSTANTS_FILE: .env.constants.test
# Skip the migrate-and-serve entrypoint; unit tests need neither.
entrypoint: []
command: pytest tests/unit/
volumes:
- ./src:/app/src
- ./tests:/app/tests
- hf_cache:/hf-cache
# Integration tests: need scout_test (migrated) + real API keys + network.
# Run with `--profile test`.
test-int:
build:
context: .
target: api-dev
profiles: ["test"]
env_file:
- .env
environment:
DATABASE_URL: postgresql+psycopg2://scout:${DB_PASSWORD}@db:5432/scout
TEST_DATABASE_URL: postgresql+psycopg2://scout:${DB_PASSWORD}@db:5432/scout_test
CONSTANTS_FILE: .env.constants.integration
# Reuse the entrypoint to wait for the DB and migrate scout (main) first,
# then migrate scout_test before running the suite.
command: >
sh -c "DATABASE_URL=$$TEST_DATABASE_URL alembic upgrade head &&
pytest tests/integration/"
volumes:
- ./src:/app/src
- ./tests:/app/tests
- hf_cache:/hf-cache
depends_on:
db:
condition: service_healthy
volumes:
frontend_node_modules: