version: "3.8"

services:
  mongo:
      container_name: walden-mongo
      build:
          context: .
          target: database
          args:
            - MONGO_ENTRY_FILE=4.4
            - MONGO_VERSION=4.4
      networks:
          - walden-backend
      volumes:
          - 'db:/data/db'
          - 'db:/data/configdb'
      restart: unless-stopped

  frontend:
    container_name: walden-frontend
    build:
        context: .
        target: base
    restart: unless-stopped
    environment:
      - NODE_ENV=production
      - MONGO_URL=mongodb://mongo:27017/bopeep
    # ports:
    #   - 3000:3000
    labels:
        - 'traefik.enable=true'
        - 'traefik.docker.network=docknet'
        - 'traefik.http.routers.labs-bopeep.rule=Host(`area51.mifi.dev`) && PathPrefix(`/bopeep`)'
        - 'traefik.http.routers.labs-bopeep.entrypoints=websecure'
        - 'traefik.http.routers.labs-bopeep.tls=true'
        - 'traefik.http.routers.labs-bopeep.tls.certresolver=letsencrypt'
        # - 'traefik.http.routers.labs-bopeep.service=labs-bopeep-service'
        # - 'traefik.http.services.labs-bopeep-service.loadbalancer.server.port=3000'
    networks:
        - walden-backend
        - docknet

networks:
    walden-backend:
        driver: bridge
        external: false
    docknet:
        name: docknet
        external: true

volumes:
    db:
        external: false
