version: "3.8"

services:
  redis:
    container_name: immich-redis
    image: redis:6.2
    restart: unless-stopped

  database:
    container_name: immich-postgres
    image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
    environment:
      POSTGRES_USER: immich
      POSTGRES_PASSWORD: Set Password
      POSTGRES_DB: immich
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: unless-stopped

  immich-server:
    container_name: immich-server
    image: ghcr.io/immich-app/immich-server:release
    depends_on:
      - redis
      - database
    environment:
      - DB_HOST=database
      - DB_PORT=5432
      - DB_USERNAME=immich
      - DB_PASSWORD=(Set Password)
      - DB_DATABASE=immich
      - REDIS_HOST=redis
      - IMMICH_MACHINE_LEARNING_URL=http://immich-machine-learning:3003
      - SERVER_HOST=0.0.0.0
    volumes:
      - /home/immich/data:/usr/src/app/upload
    ports:
      - "2283:2283"     # Expose server port to host
    restart: unless-stopped

  immich-web:
    container_name: immich-web
image: ghcr.io/immich-app/immich-web:release
    depends_on:
      - immich-server
    ports:
      - "8083:3000"     # Expose web UI port to host
    environment:
      - IMMICH_SERVER_URL=https://photos.domain.uk
    restart: unless-stopped

  immich-machine-learning:
    container_name: immich-machine-learning
    image: ghcr.io/immich-app/immich-machine-learning:release
    depends_on:
      - redis
      - database
    restart: unless-stopped

volumes:
  pgdata:
