services:
  immich-server:
    container_name: ${CONTAINER_NAME}-server
    restart: always
    networks:
      - 1panel-network
    image: altran1502/immich-server:release
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - config.env
    ports:
      - ${PANEL_APP_PORT_HTTP}:3001
    depends_on:
      - immich-redis
      - immich-database
    labels:  
      createdBy: "Apps"

  immich-microservices:
    container_name: ${CONTAINER_NAME}-microservices
    restart: always
    networks:
      - 1panel-network
    image: altran1502/immich-server:release
    # extends:
    #   file: hwaccel.yml
    #   service: hwaccel
    command: [ "start.sh", "microservices" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - config.env
    depends_on:
      - immich-redis
      - immich-database
    labels:  
      createdBy: "Apps"

  immich-machine-learning:
    container_name: ${CONTAINER_NAME}-machine_learning
    restart: always
    networks:
      - 1panel-network
    image: altran1502/immich-machine-learning:release
    volumes:
      - ${CACHE_PATH}:/cache
    env_file:
      - config.env
    labels:  
      createdBy: "Apps"

  immich-redis:
    container_name: ${CONTAINER_NAME}-redis
    restart: always
    networks:
      - 1panel-network
    image: "redis:6.2-alpine"
    labels:  
      createdBy: "Apps"

  immich-database:
    container_name: ${CONTAINER_NAME}-postgres
    restart: always
    networks:
      - 1panel-network
    image: "tensorchord/pgvecto-rs:pg14-v0.2.0"
    env_file:
      - config.env
    environment:
      - POSTGRES_PASSWORD=${PANEL_DB_USER_PASSWORD}
      - POSTGRES_USER=${PANEL_DB_USER}
      - POSTGRES_DB=${PANEL_DB_NAME}
      - POSTGRES_INITDB_ARGS=--data-checksums
    volumes:
      - ${DB_PATH}:/var/lib/postgresql/data
    command: ["postgres", "-c" ,"shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]
    labels:  
      createdBy: "Apps"

networks:  
  1panel-network:  
    external: true