# Configuration for big-bear-immich-aio-alpine setup
name: big-bear-immich-aio-alpine
# Service definitions for the big-bear-immich-aio-alpine application
services:
  # Main Immich Server service configuration
  big-bear-immich-aio-alpine:
    container_name: big-bear-immich-aio-alpine # Name of the running container
    image: ghcr.io/imagegenius/immich:2.0.0-alpine # Image to be used
    ports: # Mapping ports from the host OS to the container
      - 2283:8080
    volumes: # Mounting directories for persistent data storage
      - /DATA/AppData/$AppID/config:/config
      - /DATA/AppData/$AppID/photos:/usr/src/app/photos
      # - path_to_imports:/import:ro #optional
    environment: # Setting environment variables
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - DB_HOSTNAME=big-bear-immich-db
      - DB_USERNAME=casaos
      - DB_PASSWORD=casaos
      - DB_DATABASE_NAME=immich
      - REDIS_HOSTNAME=big-bear-immich-redis
      - DB_PORT=5432 #optional
      - REDIS_PORT=6379 #optional
      - REDIS_PASSWORD= #optional
      - MACHINE_LEARNING_GPU_ACCELERATION= #optional
      - MACHINE_LEARNING_WORKERS=1 #optional
      - MACHINE_LEARNING_WORKER_TIMEOUT=120 #optional
    depends_on: # Dependencies to ensure the order of service startup
      - big-bear-immich-redis
      - big-bear-immich-db
    restart: unless-stopped # Policy to restart unless stopped
    # Networks to be attached to the container
    networks:
      - big_bear_immich_network
    x-casaos:
      envs:
        - container: PUID
          description:
            en_us: 'Container Variable: PUID'
        - container: PGID
          description:
            en_us: 'Container Variable: PGID'
        - container: TZ
          description:
            en_us: 'Container Variable: TZ'
        - 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: REDIS_HOSTNAME
          description:
            en_us: 'Container Variable: REDIS_HOSTNAME'
        - container: DB_PORT
          description:
            en_us: 'Container Variable: DB_PORT'
        - container: REDIS_PORT
          description:
            en_us: 'Container Variable: REDIS_PORT'
        - container: REDIS_PASSWORD
          description:
            en_us: 'Container Variable: REDIS_PASSWORD'
        - container: MACHINE_LEARNING_GPU_ACCELERATION
          description:
            en_us: 'Container Variable: MACHINE_LEARNING_GPU_ACCELERATION'
        - container: MACHINE_LEARNING_WORKERS
          description:
            en_us: 'Container Variable: MACHINE_LEARNING_WORKERS'
        - container: MACHINE_LEARNING_WORKER_TIMEOUT
          description:
            en_us: 'Container Variable: MACHINE_LEARNING_WORKER_TIMEOUT'
      volumes:
        - container: /config
          description:
            en_us: 'Container Path: /config'
        - container: /usr/src/app/photos
          description:
            en_us: 'Container Path: /usr/src/app/photos'
      ports:
        - container: "8080"
          description:
            en_us: 'Container Port: 8080'
  # Configuration for Redis service
  big-bear-immich-redis:
    container_name: big-bear-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
  big-bear-immich-db:
    container_name: big-bear-immich-db # Name of the running container
    image: tensorchord/pgvecto-rs:pg14-v0.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
    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: big-bear-immich-aio-alpine
  # Detailed description for the application
  description:
    en_us: AIO Alpine. Self-hosted photo and video storage.
  # Brief tagline for the application
  tagline:
    en_us: Immich All In One Alpine
  # Developer's information
  developer: imagegenius
  # 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 AIO Alpine
  # Category under which the application falls
  category: BigBearCasaOS
  # Default port mapping for the application
  port_map: "2283"
