-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose-prod.yml
executable file
·51 lines (47 loc) · 1.38 KB
/
docker-compose-prod.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
services:
database:
image: postgres:16.3-alpine3.20
container_name: db4${COMPOSE_PROJECT_NAME}_prod
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- APP_DB_NAME=${APP_DB_NAME}
- APP_DB_USER=${APP_DB_USER}
- APP_DB_PASSWORD=${APP_DB_PASSWORD}
healthcheck:
test: [ "CMD", "pg_isready", "-q", "-d", "postgres", "-U", "$POSTGRES_USER" ]
timeout: 40s
interval: 10s
retries: 10
volumes:
- ./initdb:/docker-entrypoint-initdb.d/
- postgres_data:/var/lib/postgresql/data/
ports:
- "5432:5432"
restart: always
web:
build:
context: .
dockerfile: Dockerfile
container_name: web4${COMPOSE_PROJECT_NAME}_prod
command: >
sh -c "python3 manage.py migrate --noinput &&
python manage.py loaddata useraccounts/fixtures/initial.json &&
python manage.py loaddata website/fixtures/initial.json &&
gunicorn PersonalWebsite.wsgi:application --bind 0.0.0.0:8000"
volumes:
- static_volume:/home/appuser/personalwebsite/staticfiles
- media_volume:/home/appuser/personalwebsite/mediafiles
ports:
- "80:8000"
env_file:
- .env
environment:
- DJANGO_SETTINGS_MODULE=PersonalWebsite.settings.prod
depends_on:
database:
condition: service_healthy
restart: always
volumes:
postgres_data:
static_volume:
media_volume: