# documentation: https://immich.app/docs/overview/introduction
# slogan: Self-hosted photo and video management solution.
# category: media
# tags: photo,video,management,server,cloud,storage,sharing,metadata,face,recognition
# logo: svgs/immich.svg
# port: 2283

services:
  immich:
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      - immich-uploads:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    environment:
      - SERVICE_URL_IMMICH_2283
      - UPLOAD_LOCATION=./library
      - DB_DATA_LOCATION=./postgres
      - DB_PASSWORD=$SERVICE_PASSWORD_POSTGRES
      - DB_USERNAME=$SERVICE_USER_POSTGRES
      - DB_DATABASE_NAME=${DB_DATABASE_NAME:-immich}
      - TZ=${TZ:-Etc/UTC}
    depends_on:
      redis:
        condition: service_healthy
      database:
        condition: service_healthy
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - immich-model-cache:/cache
    environment:
      - UPLOAD_LOCATION=./library
      - DB_DATA_LOCATION=./postgres
      - DB_PASSWORD=$SERVICE_PASSWORD_POSTGRES
      - DB_USERNAME=$SERVICE_USER_POSTGRES
      - DB_DATABASE_NAME=${DB_DATABASE_NAME:-immich}
      - TZ=${TZ:-Etc/UTC}
    healthcheck:
      disable: false

  redis:
    image: redis:7.4-alpine
    healthcheck:
      test:
        - CMD
        - redis-cli
        - PING
      interval: 5s
      timeout: 10s
      retries: 20

  database:
    image: ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0
    environment:
      POSTGRES_PASSWORD: ${SERVICE_PASSWORD_POSTGRES}
      POSTGRES_USER: ${SERVICE_USER_POSTGRES}
      POSTGRES_DB: ${DB_DATABASE_NAME:-immich}
      POSTGRES_INITDB_ARGS: "--data-checksums"
      # Use 'HDD' if your database isn't stored on SSDs
      DB_STORAGE_TYPE: ${DB_STORAGE_TYPE:-SSD}
    volumes:
      - immich-postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 5s
      timeout: 20s
      retries: 10
