-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
94 lines (81 loc) · 1.95 KB
/
Copy pathdocker-compose.yml
File metadata and controls
94 lines (81 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
version: '3.8'
services:
imdb-bot:
build:
context: .
dockerfile: Dockerfile
container_name: python-imdb-bot
restart: unless-stopped
depends_on:
redis:
condition: service_healthy
# Environment variables from .env file
env_file:
- .env
environment:
- LOG_LEVEL=INFO
- PYTHONUNBUFFERED=1
- PYTHONDONTWRITEBYTECODE=1
- PYTHONOPTIMIZE=1
- REDIS_URL=redis://imdb-bot-redis:6379
- HEALTH_CHECK_PORT=8080
- DATABASE_POOL_SIZE=10
- CACHE_TTL=300
# Volumes for logs and persistent data
volumes:
- ./logs:/app/logs:rw
- ./data:/app/data:rw
# Ports for health checks
ports:
- "8080:8080"
# Health check
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Logging configuration
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Security
security_opt:
- no-new-privileges:true
read_only: false
tmpfs:
- /tmp
# Resource limits optimized for production
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
# Networks - use default network to avoid conflicts
networks:
- default
# Redis for enhanced caching and performance
redis:
image: redis:7-alpine
container_name: imdb-bot-redis
restart: unless-stopped
command: redis-server --appendonly yes --maxmemory 128mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
# Use default network to avoid conflicts
networks:
- default
volumes:
redis_data:
driver: local
# Remove custom network definition to avoid conflicts