Skip to content

Commit 62ad1df

Browse files
committed
chore(docker): run app with MongoDB 8 and healthy startup order
1 parent 0414b5c commit 62ad1df

1 file changed

Lines changed: 32 additions & 6 deletions

File tree

docker-compose.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1-
version: '2'
21
services:
2+
mongo:
3+
image: mongo:8.0
4+
restart: unless-stopped
5+
volumes:
6+
- mongo8_data:/data/db
7+
healthcheck:
8+
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand({ ping: 1 }).ok"]
9+
interval: 10s
10+
timeout: 5s
11+
retries: 5
12+
start_period: 10s
13+
314
articlemeta-restfulapi:
4-
image: scieloorg/articles_meta
15+
build:
16+
context: .
17+
dockerfile: Dockerfile
18+
image: articles_meta_local:rest
19+
depends_on:
20+
mongo:
21+
condition: service_healthy
522
environment:
623
ADMIN_TOKEN:
724
LOGGING_LEVEL: DEBUG
8-
MONGODB_HOST:
25+
MONGODB_HOST: //mongo:27017/articlemeta
926
SENTRY_DSN:
1027
command:
1128
- gunicorn
@@ -18,11 +35,17 @@ services:
1835
labels:
1936
io.rancher.container.pull_image: always
2037
articlemeta-thriftserver:
21-
image: scieloorg/articles_meta
38+
build:
39+
context: .
40+
dockerfile: Dockerfile
41+
image: articles_meta_local:thrift
42+
depends_on:
43+
mongo:
44+
condition: service_healthy
2245
environment:
2346
ADMIN_TOKEN:
2447
LOGGING_LEVEL: DEBUG
25-
MONGODB_HOST:
48+
MONGODB_HOST: //mongo:27017/articlemeta
2649
SENTRY_DSN:
2750
command:
2851
- articlemeta_thriftserver
@@ -31,4 +54,7 @@ services:
3154
- --host
3255
- 0.0.0.0
3356
labels:
34-
io.rancher.container.pull_image: always
57+
io.rancher.container.pull_image: always
58+
59+
volumes:
60+
mongo8_data:

0 commit comments

Comments
 (0)