x-defaults: &defaults
  restart: unless-stopped
  logging:
    driver: json-file
    options:
      max-size: 100m
      max-file: '3'

services:
  open_webui:
    <<: *defaults
    image: ${GHCR_IO_REGISTRY:-ghcr.io}/open-webui/open-webui:${OPEN_WEBUI_VERSION:-main}
    ports:
      - '${OPEN_WEBUI_PORT_OVERRIDE:-8080}:8080'
    volumes:
      - open_webui_data:/app/backend/data
    environment:
      - TZ=${TZ:-UTC}
    env_file:
      - .env
    # healthcheck already built into the image
    deploy:
      resources:
        limits:
          cpus: ${OPEN_WEBUI_CPU_LIMIT:-1.0}
          memory: ${OPEN_WEBUI_MEMORY_LIMIT:-1024M}
        reservations:
          cpus: ${OPEN_WEBUI_CPU_RESERVATION:-0.1}
          memory: ${OPEN_WEBUI_MEMORY_RESERVATION:-512M}

volumes:
  open_webui_data:
