# Configuration for big-bear-immich setup
name: big-bear-immich
# Service definitions for the big-bear-immich application
services:
  # Main Immich Server service configuration
  immich-server:
    container_name: immich-server # Name of the running container
    image: ghcr.io/immich-app/immich-server:v2.7.5 # Image to be used
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    ports: # Mapping ports from the host OS to the container
      - 2283:2283
    volumes: # Mounting directories for persistent data storage
      - /DATA/AppData/$AppID/upload:/usr/src/app/upload
    environment: # Setting environment variables
      DB_HOSTNAME: immich-postgres
      DB_USERNAME: casaos
      DB_PASSWORD: casaos
      DB_DATABASE_NAME: immich
      DB_PORT: "5432"
      REDIS_HOSTNAME: immich-redis
      IMMICH_MACHINE_LEARNING_URL: http://immich-machine-learning:3003
    depends_on: # Dependencies to ensure the order of service startup
      - redis
      - database
    restart: unless-stopped # Policy to restart unless stopped
    # Networks to be attached to the container
    networks:
      - big_bear_immich_network
    x-casaos:
      envs:
        - container: DB_HOSTNAME
          description:
            en_us: 'Container Variable: DB_HOSTNAME'
        - container: DB_USERNAME
          description:
            en_us: 'Container Variable: DB_USERNAME'
        - container: DB_PASSWORD
          description:
            en_us: 'Container Variable: DB_PASSWORD'
        - container: DB_DATABASE_NAME
          description:
            en_us: 'Container Variable: DB_DATABASE_NAME'
        - container: DB_PORT
          description:
            en_us: 'Container Variable: DB_PORT'
        - container: REDIS_HOSTNAME
          description:
            en_us: 'Container Variable: REDIS_HOSTNAME'
        - container: IMMICH_MACHINE_LEARNING_URL
          description:
            en_us: 'Container Variable: IMMICH_MACHINE_LEARNING_URL'
      volumes:
        - container: /usr/src/app/upload
          description:
            en_us: 'Container Path: /usr/src/app/upload'
      ports:
        - container: "2283"
          description:
            en_us: 'Container Port: 2283'
  # Configuration for Immich Machine Learning service
  immich-machine-learning:
    container_name: immich-machine-learning # Name of the running container
    image: ghcr.io/immich-app/immich-machine-learning:v2.7.5 # Image to be used
    volumes: # Mounting directories for persistent data storage
      - /DATA/AppData/$AppID/model-cache:/cache
    environment: # Setting environment variables
      DB_HOSTNAME: immich-postgres
      DB_USERNAME: casaos
      DB_PASSWORD: casaos
      DB_DATABASE_NAME: casaos
      DB_PORT: 5432
      REDIS_HOSTNAME: immich-redis
    restart: unless-stopped # Policy to restart unless stopped
    # Networks to be attached to the container
    networks:
      - big_bear_immich_network # Connects the container to a defined network
    x-casaos:
      envs:
        - container: DB_HOSTNAME
          description:
            en_us: 'Container Variable: DB_HOSTNAME'
        - container: DB_USERNAME
          description:
            en_us: 'Container Variable: DB_USERNAME'
        - container: DB_PASSWORD
          description:
            en_us: 'Container Variable: DB_PASSWORD'
        - container: DB_DATABASE_NAME
          description:
            en_us: 'Container Variable: DB_DATABASE_NAME'
        - container: DB_PORT
          description:
            en_us: 'Container Variable: DB_PORT'
        - container: REDIS_HOSTNAME
          description:
            en_us: 'Container Variable: REDIS_HOSTNAME'
      volumes:
        - container: /cache
          description:
            en_us: 'Container Path: /cache'
  # Configuration for Redis service
  redis:
    container_name: immich-redis # Name of the running container
    image: redis:6.2.20-alpine@sha256:2185e741f4c1e7b0ea9ca1e163a3767c4270a73086b6bbea2049a7203212fb7f # patched for CVE-2025-49844
    restart: always # Policy to always restart the container if it stops
    networks:
      - big_bear_immich_network # Connects the container to a defined network
  # Configuration for Database service
  database:
    container_name: immich-postgres # Name of the running container
    image: ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0 # Image to be used
    environment: # Setting environment variables
      POSTGRES_PASSWORD: casaos
      POSTGRES_USER: casaos
      POSTGRES_DB: immich
      PG_DATA: /var/lib/postgresql/data
      # Uncomment the DB_STORAGE_TYPE: 'HDD' var if your database isn't stored on SSDs
      # DB_STORAGE_TYPE: 'HDD'
    volumes: # Mounting directories for persistent data storage
      - /DATA/AppData/$AppID/pgdata:/var/lib/postgresql/data
    restart: unless-stopped # Policy to always restart the container if it stops
    # CasaOS specific configuration for the database service
    networks:
      - big_bear_immich_network # Connects the container to a defined network
    x-casaos:
      envs:
        - container: POSTGRES_PASSWORD
          description:
            en_us: 'Container Variable: POSTGRES_PASSWORD'
        - container: POSTGRES_USER
          description:
            en_us: 'Container Variable: POSTGRES_USER'
        - container: POSTGRES_DB
          description:
            en_us: 'Container Variable: POSTGRES_DB'
        - container: PG_DATA
          description:
            en_us: 'Container Variable: PG_DATA'
      volumes:
        - container: /var/lib/postgresql/data
          description:
            en_us: 'Container Path: /var/lib/postgresql/data'
networks:
  # Defines network configurations for the services
  big_bear_immich_network:
    driver: bridge # Uses bridge network driver
x-casaos:
  # Supported CPU architectures for this application
  architectures:
    - amd64
    - arm64
  # Main service for this application
  main: immich-server
  # Detailed description for the application
  description:
    en_us: Self-hosted photo and video storage.
  # Brief tagline for the application
  tagline:
    en_us: Immich
  # Developer's information
  developer: immich-app
  # Author of this particular configuration
  author: BigBearTechWorld
  # Icon URL for the application
  icon: https://cdn.jsdelivr.net/gh/selfhst/icons/png/immich.png
  # Thumbnail image for the application (if any)
  thumbnail: ""
  # Title for the application
  title:
    en_us: Immich
  # Category under which the application falls
  category: BigBearCasaOS
  # Default port mapping for the application
  port_map: "2283"
