-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
57 lines (52 loc) · 1.46 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
version: '3.9'
services:
db:
image: postgres:15
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- ./prod.env
environment:
- POSTGRES_USER=${PGUSER}
- POSTGRES_PASSWORD=${PGPASSWORD}
- POSTGRES_DB=${PGNAME}
web:
build: .
command: >
sh -c "python manage.py migrate &&
python manage.py shell -c \"from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.filter(username='${DJANGO_SUPERUSER_USERNAME}').exists() or User.objects.create_superuser('${DJANGO_SUPERUSER_USERNAME}', '${DJANGO_SUPERUSER_EMAIL}', '${DJANGO_SUPERUSER_PASSWORD}')\" &&
gunicorn wishlist_project.wsgi:application --bind 0.0.0.0:8000"
volumes:
- .:/app
- media_data:/app/media
ports:
- "8000:8000"
env_file:
- ./prod.env
nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
env_file:
- ./prod.env
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./staticfiles:/app/staticfiles
- media_data:/app/media
- /etc/letsencrypt/live/${HOST}/fullchain.pem:/etc/nginx/ssl/fullchain.pem
- /etc/letsencrypt/live/${HOST}/privkey.pem:/etc/nginx/ssl/privkey.pem
depends_on:
- web
# backup:
# build: ./backup
# volumes:
# - postgres_backup:/backups
# env_file:
# - ./prod.env
# depends_on:
# - db
volumes:
postgres_data:
media_data:
postgres_backup: