-
-
Notifications
You must be signed in to change notification settings - Fork 277
/
docker-compose.yml
127 lines (119 loc) · 3.2 KB
/
docker-compose.yml
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
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: psql -h 0.0.0.0 -U ${POSTGRES_USER:-tm} -d ${POSTGRES_DB:-tasking-manager} -c 'SELECT 1;'
start_period: 5s
interval: 10s
timeout: 5s
retries: 3
networks:
- tm-net
tm-backend:
image: ghcr.io/hotosm/tasking-manager/backend:main
build:
context: .
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:ro
- ./backend:/usr/src/app/backend:ro
- ./tests:/usr/src/app/tests:ro
- ./migrations:/src/migrations
restart: unless-stopped
healthcheck:
test: curl --fail http://localhost:5000 || exit 1
interval: 10s
retries: 5
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: .
entrypoint: ["python", "manage.py", "db"]
command: "upgrade"
depends_on:
tm-db:
condition: service_healthy
env_file:
- tasking-manager.env
volumes:
- ./pyproject.toml:/usr/src/app/pyproject.toml:ro
- ./backend:/usr/src/app/backend:ro
- ./migrations:/usr/src/app/migrations:ro
deploy:
resources:
limits:
cpus: "1"
memory: 1500M
reservations:
cpus: "1"
memory: 100M
networks:
- tm-net
swagger:
image: swaggerapi/swagger-ui:v5.11.10
restart: always
environment:
- BASE_URL=/docs
- SWAGGER_JSON_URL=http://127.0.0.1:${TM_DEV_PORT:-3000}/api/v2/system/docs/json/
labels:
- traefik.http.routers.swagger.rule=(Host(`127.0.0.1`) || Host(`localhost`)) && PathPrefix(`/docs/`)
- traefik.http.services.swagger.loadbalancer.server.port=8080
networks:
- tm-net
traefik:
image: traefik:v2.10
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
tm-frontend:
image: ghcr.io/hotosm/tasking-manager/frontend:main
build:
context: .
dockerfile: "./scripts/docker/Dockerfile.frontend_development"
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
networks:
- tm-net