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: dev
    restart: always
    command: yarn dev
    environment:
      - NODE_ENV=development
    volumes:
      - .:/app
      - /app/node_modules
      - /app/.next
    ports:
      - 3000:3000
    networks:
        - walden-backend
        - docknet
    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:
        driver: bridge
        external: false
    docknet:
        name: docknet
        external: true

volumes:
    db:
        external: false
