@@ -28,6 +28,21 @@ services:
2828 timeout : 5s
2929 retries : 3
3030
31+ migrations :
32+ image : mtsrus/syncmaster-backend:${BACKEND_IMAGE_TAG:-test}
33+ restart : unless-stopped
34+ build :
35+ dockerfile : docker/Dockerfile.backend
36+ context : .
37+ target : test
38+ volumes :
39+ - ./syncmaster:/app/syncmaster
40+ entrypoint : [python, -m, syncmaster.db.migrations, upgrade, head]
41+ env_file : .env.docker
42+ depends_on :
43+ db :
44+ condition : service_healthy
45+
3146 backend :
3247 image : mtsrus/syncmaster-backend:${BACKEND_IMAGE_TAG:-test}
3348 restart : unless-stopped
@@ -41,15 +56,22 @@ services:
4156 volumes :
4257 - ./syncmaster:/app/syncmaster
4358 - ./docs/_static:/app/docs/_static
44- - ./cached_jars:/root/.ivy2
4559 - ./reports:/app/reports
4660 - ./tests:/app/tests
4761 - ./pyproject.toml:/app/pyproject.toml
4862 depends_on :
4963 db :
5064 condition : service_healthy
65+ migrations :
66+ condition : service_completed_successfully
5167 rabbitmq :
5268 condition : service_healthy
69+ healthcheck :
70+ test : [CMD-SHELL, curl -f http://localhost:8000/monitoring/ping]
71+ interval : 30s
72+ timeout : 5s
73+ retries : 3
74+ start_period : 5s
5375 profiles : [backend, all]
5476
5577 scheduler :
@@ -68,6 +90,8 @@ services:
6890 depends_on :
6991 db :
7092 condition : service_healthy
93+ migrations :
94+ condition : service_completed_successfully
7195 rabbitmq :
7296 condition : service_healthy
7397 profiles : [scheduler, all]
@@ -94,6 +118,8 @@ services:
94118 depends_on :
95119 db :
96120 condition : service_healthy
121+ migrations :
122+ condition : service_completed_successfully
97123 rabbitmq :
98124 condition : service_healthy
99125 profiles : [worker, scheduler, s3, oracle, hdfs, hive, clickhouse, mysql, mssql, all]
0 commit comments