Skip to content

Commit

Permalink
Merge pull request #181 from AntonioMrtz/build/Backend-Container-Depe…
Browse files Browse the repository at this point in the history
…nds-on-MongoDB

Backend container depends on MongoDB container for development
  • Loading branch information
AntonioMrtz authored Aug 5, 2024
2 parents a55326a + e5a3a0a commit c6c0da4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Backend/docker/docker-compose-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ services:
- 8000:8000
env_file:
- ../.env
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
18 changes: 18 additions & 0 deletions Backend/docker/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ services:
extends:
file: docker-compose-base.yml
service: backend
depends_on:
mongo:
condition: service_healthy
environment:
MONGO_URI: mongodb://root:root@mongo:27017/

Expand All @@ -15,6 +18,12 @@ services:
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: root
healthcheck:
test: ["CMD","mongosh", "--eval", "db.adminCommand('ping')"]
interval: 5s
timeout: 5s
retries: 3
start_period: 5s

mongo-express:
image: mongo-express
Expand All @@ -26,3 +35,12 @@ services:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: root
ME_CONFIG_MONGODB_URL: mongodb://root:root@mongo:27017/
depends_on:
mongo:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s

0 comments on commit c6c0da4

Please sign in to comment.