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