-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
81 lines (76 loc) · 1.68 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
version: "3"
networks:
geoshop:
driver: bridge
services:
db:
image: postgis/postgis:15-3.4-alpine
volumes:
- "./resources/db:/docker-entrypoint-initdb.d:ro"
environment:
POSTGRES_USER: "${PGUSER}"
POSTGRES_PASSWORD: "${PGPASSWORD}"
POSTGRES_DB: "${PGDATABASE}"
LANG: "en_US.utf8"
LC_COLLATE: "en_US.utf8"
LC_CTYPE: "en_US.utf8"
env_file: .env
ports:
- 5432:5432
networks:
- geoshop
healthcheck:
test:
["CMD-SHELL", "pg_isready -h 127.0.0.1 -U ${PGUSER} -d ${PGDATABASE}"]
interval: 10s
timeout: 5s
retries: 5
migrate:
image: geoshop-api
build:
context: .
dockerfile: Dockerfile
depends_on:
db:
condition: service_healthy
env_file: .env
environment:
PGHOST: "db"
command: >
bash -c "
python3 manage.py migrate &&
python3 manage.py collectstatic --noinput &&
python3 manage.py fixturize"
volumes:
- "static-files:/app/geoshop_back/static:rw"
networks:
- geoshop
api:
image: geoshop-api
depends_on:
db:
condition: service_healthy
migrate:
condition: service_completed_successfully
env_file: .env
environment:
PGHOST: "db"
command: gunicorn wsgi -b :8000 --timeout 90
restart: unless-stopped
healthcheck:
test:
[
"CMD-SHELL",
"curl -f http://127.0.0.1:8000/health/readiness || exit 1",
]
interval: 10s
timeout: 5s
retries: 5
volumes:
- "static-files:/app/geoshop_back/static:ro"
ports:
- "8000:8000"
networks:
- geoshop
volumes:
static-files: