-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
72 lines (67 loc) · 1.99 KB
/
docker-compose.yml
File metadata and controls
72 lines (67 loc) · 1.99 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
services:
web:
build: .
command: >
bash -c "python manage.py migrate &&
python manage.py collectstatic --noinput &&
python manage.py check_env &&
gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 3 --timeout 310"
env_file:
- .env
environment:
DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE:-config.settings.development}
DATABASE_URL: ${DATABASE_URL:-postgres://portfolio:portfolio@db:5432/portfolio}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
TRANSLATION_API_URL: ${TRANSLATION_API_URL:-http://libretranslate:5000}
TRANSLATION_PROVIDER: ${TRANSLATION_PROVIDER:-libretranslate}
volumes:
- .:/app
- ./staticfiles:/app/staticfiles
- ./media:/app/media
depends_on:
- db
- redis
- libretranslate
nginx:
image: nginx:1.27
profiles: ["staging", "prod"]
depends_on:
- web
ports:
- "80:80" # Port 80 for production (HTTP standard). For local staging, use 8080 if port 80 requires admin privileges
volumes:
- ./deploy/nginx.conf:/etc/nginx/nginx.conf:ro
- ./staticfiles:/app/staticfiles:ro
- ./media:/app/media:ro
db:
image: postgres:15
environment:
POSTGRES_USER: ${POSTGRES_USER:-portfolio}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-portfolio}
POSTGRES_DB: ${POSTGRES_DB:-portfolio}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-portfolio}"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
libretranslate:
image: libretranslate/libretranslate:latest
environment:
LT_HOST: 0.0.0.0
LT_PORT: 5000
LT_LOAD_ONLY: en,es
volumes:
pgdata:
redisdata: