services:
  backend:
    image: normogen-backend:runtime
    container_name: normogen-backend
    ports:
      - "8001:8000"
    environment:
      - RUST_LOG=info
      - SERVER_PORT=8000
      - SERVER_HOST=0.0.0.0
      - MONGODB_URI=mongodb://mongodb:27017
      - MONGODB_DATABASE=normogen
      - JWT_SECRET=production-jwt-secret-key-change-this-in-production-environment-minimum-32-chars
    depends_on:
      mongodb:
        condition: service_healthy
    networks:
      - normogen-network
    restart: unless-stopped

  mongodb:
    image: mongo:6.0
    container_name: normogen-mongodb
    environment:
      - MONGO_INITDB_DATABASE=normogen
    volumes:
      - mongodb_data:/data/db
    networks:
      - normogen-network
    healthcheck:
      test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 40s
    restart: unless-stopped

volumes:
  mongodb_data:
    driver: local

networks:
  normogen-network:
    driver: bridge
