version: '3.8' services: mongodb: image: mongodb/mongodb-community-server container_name: tort-mongodb restart: always network_mode: bridge environment: MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER} MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASS} ports: - "127.0.0.1:${MONGO_PORT}:27017" healthcheck: test: ["CMD", "mongosh", "--username", "${MONGO_USER}", "--password", "${MONGO_PASS}", "--eval", "db.runCommand({ ping: 1 })"] interval: 10s timeout: 5s retries: 2 backend: build: context: ./app image: tort-backend:latest depends_on: mongodb: condition: service_healthy container_name: tort-backend network_mode: "host" environment: MONGO_HOST: ${MONGO_HOST} MONGO_PORT: ${MONGO_PORT} MONGO_USER: ${MONGO_USER} MONGO_PASS: ${MONGO_PASS}