version: "3.7"

services:
  emulatorjs:
    container_name: emulatorjs
    image: lscr.io/linuxserver/emulatorjs:1.9.0
    ports:
      - ${APP_PORT}:80
      - 8165:3000
    volumes:
      - ${APP_DATA_DIR}/data/emulatorjs-config:/config
      - ${APP_DATA_DIR}/data/emulatorjs:/data
    environment:
      - TZ=${TZ}
    restart: unless-stopped
    networks:
      - tipi_main_network
    labels:
      # Main
      traefik.enable: true
      traefik.http.middlewares.emulatorjs-web-redirect.redirectscheme.scheme: https
      traefik.http.services.emulatorjs.loadbalancer.server.port: 80
      # Web
      traefik.http.routers.emulatorjs-insecure.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.emulatorjs-insecure.entrypoints: web
      traefik.http.routers.emulatorjs-insecure.service: emulatorjs
      traefik.http.routers.emulatorjs-insecure.middlewares: emulatorjs-web-redirect
      # Websecure
      traefik.http.routers.emulatorjs.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.emulatorjs.entrypoints: websecure
      traefik.http.routers.emulatorjs.service: emulatorjs
      traefik.http.routers.emulatorjs.tls.certresolver: myresolver
      # Local domain
      traefik.http.routers.emulatorjs-local-insecure.rule: Host(`emulatorjs.${LOCAL_DOMAIN}`)
      traefik.http.routers.emulatorjs-local-insecure.entrypoints: web
      traefik.http.routers.emulatorjs-local-insecure.service: emulatorjs
      traefik.http.routers.emulatorjs-local-insecure.middlewares: emulatorjs-web-redirect
      # Local domain secure
      traefik.http.routers.emulatorjs-local.rule: Host(`emulatorjs.${LOCAL_DOMAIN}`)
      traefik.http.routers.emulatorjs-local.entrypoints: websecure
      traefik.http.routers.emulatorjs-local.service: emulatorjs
      traefik.http.routers.emulatorjs-local.tls: true
