version: "3.8"

networks:
  immich_default:
    name: immich_default

services:
  immich-server:
    container_name: immich-server
    image: ghcr.io/immich-app/immich-server:release
    depends_on:
      - redis
      - database
    restart: always
    volumes:
      - /mnt/omv_immich_smb/upload:/usr/src/app/upload # If Immich expects 'upload' at this container path
      - /mnt/omv_immich_smb/library:/usr/src/app/library # If Immich expects 'library' at this container path
      - /mnt/omv_immich_pics/:/usr/src/app/external-libraries/pictures:ro # For your external pictures library
    environment:
      - DB_HOST=database
      - DB_PORT=5432
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_DATABASE=immich
      - REDIS_HOST=redis
      - DB_VECTOR_EXTENSION=pgvecto.rs
    ports:
      - 2283:2283
    networks:
      - immich_default


  immich-machine-learning:
    container_name: immich-machine-learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    restart: always
    volumes:
      - /mnt/omv_immich_smb/upload:/usr/src/app/upload # If Immich expects 'upload' at this container path
      - /mnt/omv_immich_smb/library:/usr/src/app/library # If Immich expects 'library' at this container path
      - /mnt/omv_immich_pics/:/usr/src/app/external-libraries/pictures:ro # For your external pictures library
      - model-cache:/cache 
    environment:
      - DB_HOST=database
      - DB_PORT=5432
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_DATABASE=immich
      - REDIS_HOST=redis
      - DB_VECTOR_EXTENSION=pgvecto.rs
    networks:
      - immich_default

  redis:
    container_name: immich-redis
    image: redis:${REDIS_VERSION:-7.2-alpine}
    restart: always
    networks:
      - immich_default

  database:
    container_name: immich-postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0
    restart: always
    volumes:
      - pgdata:/var/lib/postgresql/data

    environment:
    - POSTGRES_USER=postgres
    - POSTGRES_PASSWORD=postgres
    - POSTGRES_DB=immich
    networks:
      - immich_default
      
  immich-web:
    container_name: immich-web
    image: ghcr.io/immich-app/immich-web:release
    restart: always
    environment:
      - SERVER_ENDPOINT=http://immich-server:2283
    ports:
      - 2284:3000
    networks:
      - immich_default
      
volumes:
  pgdata:
  model-cache: