services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:v2.5.6
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      - ${UPLOAD_LOCATION}:/data
      - ${IMMICH_EXTERNAL_MEDIA_LOCATION}:/external:ro
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    environment:
      DB_HOSTNAME: ${IMMICH_DB_HOSTNAME}
      DB_USERNAME: ${IMMICH_POSTGRES_USER}
      DB_PASSWORD: ${IMMICH_POSTGRES_PASSWORD}
      DB_DATABASE_NAME: ${IMMICH_POSTGRES_DB}
    ports:
      - '2283:2283'
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:v2.5.6
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: docker.io/valkey/valkey:9@sha256:fb8d272e529ea567b9bf1302245796f21a2672b8368ca3fcb938ac334e613c8f
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  database:
    container_name: immich_postgres
    image: ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0
    environment:
      POSTGRES_USER: ${IMMICH_POSTGRES_USER}
      POSTGRES_PASSWORD: ${IMMICH_POSTGRES_PASSWORD}
      POSTGRES_DB: ${IMMICH_POSTGRES_DB}
      POSTGRES_INITDB_ARGS: '--data-checksums'
      DB_STORAGE_TYPE: 'HDD'
    ports:
      - 5433:5432
    volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${IMMICH_DB_LOCATION}:/var/lib/postgresql/data
    shm_size: 128mb
    restart: always

volumes:
  model-cache:
