-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
90 lines (86 loc) · 2.5 KB
/
Copy pathdocker-compose.yml
File metadata and controls
90 lines (86 loc) · 2.5 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
services:
# Redis for Celery message broker and caching
redis:
image: redis:7-alpine
container_name: portfolio-redis
# No external port mapping - only accessible within Docker network
volumes:
- redis_data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- portfolio-network
# Flask web application
web:
build:
context: .
dockerfile: Dockerfile
container_name: portfolio-web
ports:
- "5000:5000"
volumes:
# Mount entire directory for live code updates
- .:/app
# REMOVED redundant instance mount that could cause conflicts
# instance/ folder is already included in .:/app mount
- ./backups:/app/backups
environment:
- FLASK_ENV=development
- SECRET_KEY=${SECRET_KEY:-dev-secret-change-in-production}
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
- ADMIN_PASSWORD_HASH=${ADMIN_PASSWORD_HASH}
- MAIL_SERVER=${MAIL_SERVER:-smtp.gmail.com}
- MAIL_PORT=${MAIL_PORT:-587}
- MAIL_USE_TLS=${MAIL_USE_TLS:-True}
- MAIL_USERNAME=${MAIL_USERNAME}
- MAIL_PASSWORD=${MAIL_PASSWORD}
- MAIL_DEFAULT_SENDER=${MAIL_DEFAULT_SENDER}
- MAIL_RECIPIENT=${MAIL_RECIPIENT}
depends_on:
redis:
condition: service_healthy
command: python wsgi.py
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- portfolio-network
# Celery worker for async tasks
celery-worker:
build:
context: .
dockerfile: Dockerfile
container_name: portfolio-celery
volumes:
- .:/app
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- MAIL_SERVER=${MAIL_SERVER:-smtp.gmail.com}
- MAIL_PORT=${MAIL_PORT:-587}
- MAIL_USE_TLS=${MAIL_USE_TLS:-True}
- MAIL_USERNAME=${MAIL_USERNAME}
- MAIL_PASSWORD=${MAIL_PASSWORD}
depends_on:
redis:
condition: service_healthy
web:
condition: service_started
command: celery -A app.celery_config.celery worker --loglevel=info --pool=solo
networks:
- portfolio-network
networks:
portfolio-network:
driver: bridge
volumes:
redis_data:
driver: local