-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
58 lines (54 loc) · 1.58 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
version: '3'
services:
db:
image: postgres:15.3
restart: always
ports:
- ${POSTGRES_PORT}:5432
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_HOST_AUTH_METHOD: "trust"
volumes:
- postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"]
interval: 30s
timeout: 60s
retries: 5
start_period: 80s
web-app:
build: .
restart: always
command: >
sh -c "python manage.py makemigrations --noinput
&& python manage.py migrate --noinput
&& python manage.py createsuperuser --noinput --username ${DJANGO_SUPERUSER_USERNAME} --email ${DJANGO_SUPERUSER_EMAIL}
&& python manage.py runserver 0.0.0.0:${WEB_PORT}"
volumes:
- .:/code
ports:
- 8000:8000
environment:
POSTGRES_HOST: "db"
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_PORT: ${POSTGRES_PORT}
DJANGO_SUPERUSER_USERNAME: ${DJANGO_SUPERUSER_USERNAME}
DJANGO_SUPERUSER_EMAIL: ${DJANGO_SUPERUSER_EMAIL}
DJANGO_SUPERUSER_PASSWORD: ${DJANGO_SUPERUSER_PASSWORD}
WEB_PORT: ${WEB_PORT}
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl --fail http://0.0.0.0:${WEB_PORT}/ || exit 1"]
interval: 30s
timeout: 60s
retries: 5
start_period: 80s
volumes:
postgres:
driver: local