services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: allAndOne

    env_file:
      - .env
    ports:
      - "3000:3000"
    volumes:
      - .:/app
      - /app/node_modules
      - /app/.next
    labels:
      - traefik.enable=true
      - traefik.docker.network=traefik-public
      - traefik.constraint-label=traefik-public
      - traefik.http.routers.${STACK_NAME?Variable not set}-app-http.rule=Host(`${DOMAIN?Variable not set}`)
      - traefik.http.routers.${STACK_NAME?Variable not set}-app-http.entrypoints=http
      - traefik.http.routers.${STACK_NAME?Variable not set}-app-http.middlewares=https-redirect
      - traefik.http.routers.${STACK_NAME?Variable not set}-app-https.rule=Host(`${DOMAIN?Variable not set}`)
      - traefik.http.routers.${STACK_NAME?Variable not set}-app-https.entrypoints=https
      - traefik.http.routers.${STACK_NAME?Variable not set}-app-https.tls=true
      - traefik.http.routers.${STACK_NAME?Variable not set}-app-https.tls.certresolver=le
      - traefik.http.services.${STACK_NAME?Variable not set}-app.loadbalancer.server.port=3000

    networks:
      - traefik-public
networks:
  traefik-public:
    # Allow setting it to false for testing
    external: true
