@@ -28,6 +28,24 @@ services:
2828 timeout : 5s
2929 retries : 3
3030
31+ # Using worker image here to skip building backend image build in CI.
32+ # Worker test image already has all neccessary dependencies
33+ migrations :
34+ image : mtsrus/syncmaster-worker:${WORKER_IMAGE_TAG:-test}
35+ restart : none
36+ build :
37+ dockerfile : docker/Dockerfile.worker
38+ context : .
39+ target : test
40+ volumes :
41+ - ./syncmaster:/app/syncmaster
42+ - ./tests:/app/tests
43+ entrypoint : [python, -m, syncmaster.db.migrations, upgrade, head]
44+ env_file : .env.docker
45+ depends_on :
46+ db :
47+ condition : service_healthy
48+
3149 backend :
3250 image : mtsrus/syncmaster-backend:${BACKEND_IMAGE_TAG:-test}
3351 restart : unless-stopped
@@ -41,15 +59,22 @@ services:
4159 volumes :
4260 - ./syncmaster:/app/syncmaster
4361 - ./docs/_static:/app/docs/_static
44- - ./cached_jars:/root/.ivy2
4562 - ./reports:/app/reports
4663 - ./tests:/app/tests
4764 - ./pyproject.toml:/app/pyproject.toml
4865 depends_on :
4966 db :
5067 condition : service_healthy
68+ migrations :
69+ condition : service_completed_successfully
5170 rabbitmq :
5271 condition : service_healthy
72+ healthcheck :
73+ test : [CMD-SHELL, curl -f http://localhost:8000/monitoring/ping]
74+ interval : 30s
75+ timeout : 5s
76+ retries : 3
77+ start_period : 5s
5378 profiles : [backend, all]
5479
5580 scheduler :
@@ -68,6 +93,8 @@ services:
6893 depends_on :
6994 db :
7095 condition : service_healthy
96+ migrations :
97+ condition : service_completed_successfully
7198 rabbitmq :
7299 condition : service_healthy
73100 profiles : [scheduler, all]
@@ -94,6 +121,8 @@ services:
94121 depends_on :
95122 db :
96123 condition : service_healthy
124+ migrations :
125+ condition : service_completed_successfully
97126 rabbitmq :
98127 condition : service_healthy
99128 profiles : [worker, scheduler, s3, oracle, hdfs, hive, clickhouse, mysql, mssql, all]
0 commit comments