-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose-prod.yml
executable file
·45 lines (43 loc) · 1.39 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
services:
database:
image: postgres:16.3-alpine3.20
container_name: db4${COMPOSE_PROJECT_NAME}
restart: always
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
healthcheck:
test: [ "CMD", "pg_isready", "-q", "-d", "postgres", "-U", "$POSTGRES_USER" ]
interval: 30s
timeout: 10s
retries: 10
volumes:
- ./initdb:/docker-entrypoint-initdb.d/
- postgres_data:/var/lib/postgresql/data/
ports:
- "5432:5432"
web:
build:
context: .
dockerfile: Dockerfile
container_name: web4${COMPOSE_PROJECT_NAME}
command: python /home/app/website/manage.py runserver 0.0.0.0:8000
volumes:
- static_volume:/home/app/website/staticfiles
- media_volume:/home/app/website/mediafiles
ports:
- "80:8000"
env_file:
- .env_prod
environment:
- DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${DB_NAME}
- DJANGO_SETTINGS_MODULE=mywebsite.settings.prod
depends_on:
database:
condition: service_healthy
volumes:
postgres_data:
static_volume:
media_volume: