-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
122 lines (113 loc) · 3.6 KB
/
docker-compose.yml
File metadata and controls
122 lines (113 loc) · 3.6 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Docker Compose for Movie Recommendation System with Airflow
# Run: docker-compose -f docker-compose.airflow.yml up -d
version: "3.8"
x-airflow-common: &airflow-common
image: apache/airflow:2.8.0-python3.11
environment:
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
- AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres/airflow
- AIRFLOW__CORE__FERNET_KEY=${FERNET_KEY}
- AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION=false
- AIRFLOW__CORE__LOAD_EXAMPLES=false
- AIRFLOW__WEBSERVER__EXPOSE_CONFIG=true
- KAGGLE_USERNAME=${KAGGLE_USERNAME}
- KAGGLE_KEY=${KAGGLE_KEY}
- TMDB_API_KEY=${TMDB_API_KEY:-44726ef95f4d79cb7001a4947fca7f53}
volumes:
- ./airflow/dags:/opt/airflow/dags
- ./airflow/logs:/opt/airflow/logs
- ./:/opt/airflow/movie-rec
- airflow-kaggle:/root/.kaggle
depends_on:
postgres:
condition: service_healthy
services:
postgres:
image: postgres:15
environment:
- POSTGRES_USER=airflow
- POSTGRES_PASSWORD=airflow
- POSTGRES_DB=airflow
volumes:
- postgres-db:/var/lib/postgresql/data
healthcheck:
test: [ "CMD", "pg_isready", "-U", "airflow" ]
interval: 5s
retries: 5
restart: unless-stopped
airflow-init:
<<: *airflow-common
container_name: airflow-init
entrypoint: /bin/bash
command:
- -c
- |
pip install kaggle faiss-cpu scikit-learn pandas pyarrow pandera joblib
airflow db init
airflow users create --username admin --password admin --firstname Admin --lastname User --role Admin --email admin@example.com || true
mkdir -p /root/.kaggle
echo '{"username":"'$$KAGGLE_USERNAME'","key":"'$$KAGGLE_KEY'"}' > /root/.kaggle/kaggle.json
chmod 600 /root/.kaggle/kaggle.json
restart: "no"
airflow-webserver:
<<: *airflow-common
container_name: airflow-webserver
command: bash -c "pip install kaggle faiss-cpu scikit-learn pandas pyarrow pandera joblib && airflow webserver"
ports:
- "8080:8080"
healthcheck:
test: [ "CMD", "curl", "--fail", "http://localhost:8080/health" ]
interval: 30s
timeout: 10s
retries: 5
restart: unless-stopped
airflow-scheduler:
<<: *airflow-common
container_name: airflow-scheduler
command: bash -c "pip install kaggle faiss-cpu scikit-learn pandas pyarrow pandera joblib pyspark sentence-transformers httpx && airflow scheduler"
healthcheck:
test: [ "CMD-SHELL", "airflow jobs check --job-type SchedulerJob --hostname $(hostname)" ]
interval: 30s
timeout: 10s
retries: 5
restart: unless-stopped
# Movie Recommendation Backend
backend:
build:
context: .
dockerfile: Dockerfile
container_name: movie-rec-backend
ports:
- "8000:8000"
volumes:
- ./data:/app/data
- ./models:/app/models
environment:
- TMDB_API_KEY=${TMDB_API_KEY}
command: uvicorn backend.main:app --host 0.0.0.0 --port 8000
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8000/health" ]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
# Movie Recommendation Frontend
frontend:
build:
context: .
dockerfile: Dockerfile
container_name: movie-rec-frontend
ports:
- "8501:8501"
volumes:
- ./data:/app/data
- ./models:/app/models
environment:
- API_BASE_URL=http://backend:8000
command: streamlit run streamlit_app.py --server.port 8501 --server.address 0.0.0.0
depends_on:
- backend
restart: unless-stopped
volumes:
postgres-db:
airflow-kaggle: