services:
  memos:
    image: neosmemo/memos:stable
    restart: unless-stopped
    user: "0"
    entrypoint: ["sh", "-c", "chown -R 10001:10001 /var/opt/memos && su -s /bin/sh 10001 -c '/usr/local/memos/memos'"]
    volumes:
      - memos_data:/var/opt/memos
    environment:
      - MEMOS_MODE=${MEMOS_MODE}
      - MEMOS_PORT=${MEMOS_PORT}
    ports:
      - "5230"
    networks:
      - dokploy-network
    labels:
      - traefik.http.routers.memos-web.rule=Host(`memos.bendtstudio.com`)
      - traefik.http.routers.memos-web.entrypoints=web
      - traefik.http.services.memos-web.loadbalancer.server.port=5230
      - traefik.http.routers.memos-web.service=memos-web
      - traefik.http.routers.memos-web.middlewares=redirect-to-https@file
      - traefik.http.routers.memos-websecure.rule=Host(`memos.bendtstudio.com`)
      - traefik.http.routers.memos-websecure.entrypoints=websecure
      - traefik.http.services.memos-websecure.loadbalancer.server.port=5230
      - traefik.http.routers.memos-websecure.service=memos-websecure
      - traefik.http.routers.memos-websecure.tls.certresolver=letsencrypt
      - traefik.enable=true

volumes:
  memos_data:

networks:
  dokploy-network:
    external: true
