-
-
Notifications
You must be signed in to change notification settings - Fork 289
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
159 lines (151 loc) · 4.03 KB
/
docker-compose.yml
File metadata and controls
159 lines (151 loc) · 4.03 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: tasking-manager-main
volumes:
tm_db_data:
name: tm-db-data-main
networks:
tm-net:
name: tm-net
services:
tm-db:
image: "postgis/postgis:${POSTGIS_TAG:-14-3.3}"
volumes:
- tm_db_data:/var/lib/postgresql/data/
env_file:
- tasking-manager.env
restart: unless-stopped
healthcheck:
test: pg_isready -U ${POSTGRES_USER:-tm} -d ${POSTGRES_DB:-test_db}
start_period: 35s
interval: 10s
timeout: 5s
retries: 3
labels:
- "traefik.enable=false"
networks:
- tm-net
tm-backend:
image: ghcr.io/hotosm/tasking-manager/backend:main
build:
context: .
target: ${TARGET_TAG:-debug}
dockerfile: ./scripts/docker/Dockerfile
depends_on:
tm-db:
condition: service_healthy
tm-migration:
condition: service_completed_successfully
env_file:
- tasking-manager.env
volumes:
- ./pyproject.toml:/usr/src/app/pyproject.toml
- ./uv.lock:/usr/src/app/uv.lock
- ./backend:/usr/src/app/backend
- ./tests:/usr/src/app/tests
- ./migrations:/usr/src/app/migrations/
ports:
- 5678:5678 #DebugPy
restart: unless-stopped
healthcheck:
test: curl --fail http://localhost:5000/api/docs
interval: 10s
retries: 5
start_period: 10s
timeout: 3s
deploy:
replicas: ${API_REPLICAS:-1}
resources:
limits:
cpus: "1"
memory: 1500M
reservations:
cpus: "1"
memory: 100M
labels:
- traefik.http.routers.backend.rule=(Host(`127.0.0.1`) || Host(`localhost`)) && PathPrefix(`/api/`)
- traefik.http.services.backend.loadbalancer.server.port=5000
networks:
- tm-net
tm-migration:
image: ghcr.io/hotosm/tasking-manager/backend:main
build:
context: .
target: ${TARGET_TAG:-debug}
dockerfile: ./scripts/docker/Dockerfile
entrypoint: ["alembic", "-c", "migrations/alembic.ini", "upgrade", "head"]
depends_on:
tm-db:
condition: service_healthy
env_file:
- tasking-manager.env
volumes:
- ./pyproject.toml:/usr/src/app/pyproject.toml
- ./uv.lock:/usr/src/app/uv.lock
- ./backend:/usr/src/app/backend
- ./tests:/usr/src/app/tests
- ./migrations:/usr/src/app/migrations/
deploy:
replicas: ${API_REPLICAS:-1}
resources:
limits:
cpus: "1"
memory: 1500M
reservations:
cpus: "1"
memory: 100M
networks:
- tm-net
tm-cron-jobs:
image: ghcr.io/hotosm/tasking-manager/backend:main
build:
context: .
target: ${TARGET_TAG:-debug}
dockerfile: ./scripts/docker/Dockerfile
command: ["python", "backend/cron_jobs.py"]
depends_on:
tm-db:
condition: service_healthy
env_file:
- tasking-manager.env
environment:
- PYTHONPATH=/usr/src/app
deploy:
replicas: 1
resources:
limits:
cpus: "0.5"
memory: 256M
reservations:
cpus: "0.2"
memory: 128M
networks:
- tm-net
tm-frontend:
# NOTE: For Frontend development with docker-compose
# - Uncomment volume section below to enable live reload of frontend code
# - Add `TARGET_TAG=debug` to your `tasking-manager.env` or new `.env` file
image: ghcr.io/hotosm/tasking-manager/frontend:main
build:
context: .
dockerfile: "./scripts/docker/Dockerfile.frontend"
target: ${TARGET_TAG:-prod}
env_file:
- tasking-manager.env
labels:
- traefik.http.routers.frontend.rule=Host(`127.0.0.1`) || Host(`localhost`)
- traefik.http.services.frontend.loadbalancer.server.port=3000
# volumes:
# - ./frontend:/usr/src/app
networks:
- tm-net
traefik:
image: traefik:v3.6.1
restart: always
ports:
- "${TM_DEV_PORT:-3000}:80"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
command:
- --entrypoints.web.address=:80
- --providers.docker=true
networks:
- tm-net