-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
62 lines (59 loc) · 1.54 KB
/
docker-compose.yml
File metadata and controls
62 lines (59 loc) · 1.54 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
version: '3.8'
services:
portfolio:
image: portfolio_portfolio:latest
container_name: portfolio-app
restart: unless-stopped
ports:
- "8000:8000"
environment:
- DJANGO_DEBUG=False
- DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}
- ALLOWED_HOSTS=${ALLOWED_HOSTS}
- YOUTUBE_API_KEY=${YOUTUBE_API_KEY}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-us-east-1}
- AWS_REGION=${AWS_DEFAULT_REGION:-us-east-1}
- MPLCONFIGDIR=/app/.config/matplotlib
- PYTHONUNBUFFERED=1
volumes:
# Persist database and media files
- portfolio_db:/app/db_data
- portfolio_media:/app/media
- portfolio_logs:/app/logs
# Resource limits for small droplet
deploy:
resources:
limits:
memory: 1.5G
cpus: '1.0'
reservations:
memory: 512M
cpus: '0.5'
# Health check
healthcheck:
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:8000/', timeout=10)"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Security
security_opt:
- no-new-privileges:true
read_only: false
tmpfs:
- /tmp:noexec,nosuid,size=100m
# Connect to the shared application network
networks:
- app_network
volumes:
portfolio_db:
driver: local
portfolio_media:
driver: local
portfolio_logs:
driver: local
networks:
app_network:
external: true