version: '3.8' services: # MongoDB Database Service mongo: image: mongo:7.0 container_name: oramap-mongo environment: - MONGO_INITDB_DATABASE=oramap ports: - "27017:27017" volumes: - mongo-data:/data/db restart: unless-stopped healthcheck: test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"] interval: 10s timeout: 5s retries: 5 start_period: 10s networks: - oramap-network # Backend API Service backend: build: context: ./backend dockerfile: Dockerfile image: oramap-backend:latest container_name: oramap-backend environment: - NODE_ENV=production - PORT=3000 - MONGODB_URI=mongodb://mongo:27017/oramap depends_on: mongo: condition: service_healthy restart: unless-stopped healthcheck: test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"] interval: 30s timeout: 3s retries: 3 start_period: 5s networks: - oramap-network # Frontend Nginx Service frontend: build: context: ./frontend dockerfile: Dockerfile image: oramap-frontend:latest container_name: oramap-frontend ports: - "80:80" depends_on: backend: condition: service_healthy restart: unless-stopped healthcheck: test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/"] interval: 30s timeout: 3s retries: 3 start_period: 5s networks: - oramap-network networks: oramap-network: driver: bridge volumes: mongo-data: driver: local