-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
78 lines (72 loc) · 1.95 KB
/
docker-compose.yml
File metadata and controls
78 lines (72 loc) · 1.95 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
version: '3.9'
services:
db:
image: postgres:16-alpine
container_name: tradie_db
environment:
POSTGRES_DB: ${DB_NAME:-tradie_db}
POSTGRES_USER: ${DB_USER:-tradie_user}
POSTGRES_PASSWORD: ${DB_PASSWORD:-secure_password_change_me}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- tradie_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-tradie_user}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
web:
build:
context: .
dockerfile: Dockerfile
container_name: tradie_web
command: >
sh -c "python manage.py migrate &&
python manage.py collectstatic --noinput &&
gunicorn --bind 0.0.0.0:8000 --workers 4 TradieRMProject.wsgi:application"
ports:
- "${WEB_PORT:-8000}:8000"
environment:
- DEBUG=${DEBUG:-False}
- ALLOWED_HOSTS=${ALLOWED_HOSTS:-localhost,127.0.0.1}
- SECRET_KEY=${SECRET_KEY:-your-secret-key-here}
- DATABASE_URL=postgresql://${DB_USER:-tradie_user}:${DB_PASSWORD:-secure_password_change_me}@db:5432/${DB_NAME:-tradie_db}
volumes:
- .:/app
- static_volume:/app/staticfiles
- media_volume:/app/media
depends_on:
db:
condition: service_healthy
networks:
- tradie_network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/admin/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
nginx:
image: nginx:alpine
container_name: tradie_nginx
ports:
- "${NGINX_PORT:-80}:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- static_volume:/app/staticfiles:ro
- media_volume:/app/media:ro
depends_on:
- web
networks:
- tradie_network
restart: unless-stopped
volumes:
postgres_data:
static_volume:
media_volume:
networks:
tradie_network:
driver: bridge