-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
45 lines (42 loc) · 1.19 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
version: "3.8"
services:
db:
image: postgis/postgis
container_name: postgis
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data/
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
django:
build:
context: .
depends_on:
db:
condition: service_healthy
container_name: django
command: >
sh -c "
# DJANGO_SUPERUSER_USERNAME='admin' DJANGO_SUPERUSER_EMAIL='[email protected]' DJANGO_SUPERUSER_PASSWORD='admin' python manage.py createsuperuser --noinput &&
python manage.py makemigrations &&
python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000"
volumes:
- .:/usr/src/app/
- /usr/src/app/venv # Exclude the virtual environment directory
ports:
- "8000:8000"
environment:
- DEBUG=1
- DATABASE_URL=postgis://postgres:postgres@db:5432/postgres
restart: always # Automatically restart the container if it crashes
volumes:
postgres_data: