version: '3.7'
services:
  mealie-1:
    container_name: mealie-1
    image: ghcr.io/mealie-recipes/mealie:v1.6.0
    restart: unless-stopped
    ports:
      - ${APP_PORT}:9000
    deploy:
      resources:
        limits:
          memory: 1000M
    environment:
      ALLOW_SIGNUP: ${MEALIE_ALLOW_SIGNUP}
      PUID: 1000
      PGID: 1000
      TZ: ${TZ}
      MAX_WORKERS: 1
      WEB_CONCURRENCY: 1
      BASE_URL: ${APP_PROTOCOL:-http}://${APP_DOMAIN}
    volumes:
      - ${APP_DATA_DIR}/data:/app/data
    networks:
      - tipi_main_network
    labels:
      # Main
      traefik.enable: true
      traefik.http.middlewares.mealie-web-redirect.redirectscheme.scheme: https
      traefik.http.services.mealie.loadbalancer.server.port: 9000
      # Web
      traefik.http.routers.mealie-insecure.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.mealie-insecure.entrypoints: web
      traefik.http.routers.mealie-insecure.service: mealie
      traefik.http.routers.mealie-insecure.middlewares: mealie-web-redirect
      # Websecure
      traefik.http.routers.mealie.rule: Host(`${APP_DOMAIN}`)
      traefik.http.routers.mealie.entrypoints: websecure
      traefik.http.routers.mealie.service: mealie
      traefik.http.routers.mealie.tls.certresolver: myresolver
      # Local domain
      traefik.http.routers.mealie-local-insecure.rule: Host(`mealie.${LOCAL_DOMAIN}`)
      traefik.http.routers.mealie-local-insecure.entrypoints: web
      traefik.http.routers.mealie-local-insecure.service: mealie
      traefik.http.routers.mealie-local-insecure.middlewares: mealie-web-redirect
      # Local domain secure
      traefik.http.routers.mealie-local.rule: Host(`mealie.${LOCAL_DOMAIN}`)
      traefik.http.routers.mealie-local.entrypoints: websecure
      traefik.http.routers.mealie-local.service: mealie
      traefik.http.routers.mealie-local.tls: true
