Repository navigation
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
95 lines (89 loc) · 2.19 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
95 lines (89 loc) · 2.19 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
85
86
87
88
89
90
91
92
93
94
95
# Development overrides.
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.dev.yml up
services:
api:
build:
context: .
dockerfile: Dockerfile
target: development
container_name: notify-api
command: >
uvicorn app.main:app
--host 0.0.0.0
--port 8000
--reload
--reload-dir /app/app
env_file:
- .env.dev
environment:
DEBUG: "true"
restart: unless-stopped
volumes:
# Mount source for hot-reload
- ./app:/app/app:ro
- ./tests:/app/tests:ro
- ./alembic:/app/alembic:ro
- ./run.py:/app/run.py:ro
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
networks:
- backend
migrate:
build:
context: .
dockerfile: Dockerfile
target: development
env_file:
- .env.dev
command: alembic upgrade head
restart: "no"
profiles: [ "migrate" ] # use to run this service with docker compose -f docker-compose.yml -f docker-compose.dev.yml --profile migrate up
depends_on:
db:
condition: service_healthy
networks:
- backend
# Expose DB & Redis to the host for local tools (psql, redis-cli, TablePlus)
db:
ports:
- "5432:5432"
env_file:
- .env.dev
redis:
ports:
- "6379:6379"
# MailHog — fake SMTP + web UI for testing emails locally
mailhog:
image: mailhog/mailhog:latest
container_name: notify-mailhog
restart: unless-stopped
ports:
- "1025:1025" # SMTP
- "8025:8025" # Web UI — http://localhost:8025
networks:
- backend
# Test database (only when running tests)
db-test:
image: postgres:17-alpine
container_name: notify-db-test
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
POSTGRES_DB: notif_test
ports:
- "5433:5432"
networks:
- backend
profiles: [ "test" ] #docker compose -f docker-compose.yml -f docker-compose.dev.yml --profile test up -d db-test
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U user -d notif_test" ]
interval: 3s
timeout: 3s
retries: 5