-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdocker-compose.yml
39 lines (37 loc) · 958 Bytes
/
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
version: '3.8'
services:
web:
build: ./app
command: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; python manage.py runserver 0.0.0.0:8000'
volumes:
- ./app:/app
expose:
- 8000
environment:
- DEBUG=1
- DATABASE_URL=postgresql://django_traefik:django_traefik@db:5432/django_traefik
depends_on:
- db
labels:
- "traefik.enable=true"
- "traefik.http.routers.django.rule=Host(`django.localhost`)"
db:
image: postgres:15-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
expose:
- 5432
environment:
- POSTGRES_USER=django_traefik
- POSTGRES_PASSWORD=django_traefik
- POSTGRES_DB=django_traefik
traefik:
image: traefik:v2.9.6
ports:
- 8008:80
- 8081:8080
volumes:
- "$PWD/traefik.dev.toml:/etc/traefik/traefik.toml"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
volumes:
postgres_data: