# stack for immich <= v1.87.0

version: "3.8"

services:
  immich-server:
    container_name: immich-server
    image: altran1502/immich-server:v1.87.0
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - immich-redis
      - immich-database
      - immich-typesense
    restart: unless-stopped
    #labels:
    #  - "com.centurylinklabs.watchtower.enable=true"
    #networks:
    #  - proxy

  immich-microservices:
    container_name: immich-microservices
    image: altran1502/immich-server:v1.87.0
    command: [ "start.sh", "microservices" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - immich-redis
      - immich-database
      - immich-typesense
    restart: unless-stopped
    #labels:
    #  - "com.centurylinklabs.watchtower.enable=true"
    #networks:
    #  - proxy    
    
  immich-typesense:
    container_name: immich-typesense
    hostname: typesense
    image: typesense/typesense:0.24.1
    environment:
      - TYPESENSE_API_KEY=${TYPESENSE_API_KEY}
      - TYPESENSE_DATA_DIR=/data
      # remove this to get debug messages
      - GLOG_minloglevel=1
    volumes:
      - ${TYPESENSE_LOCATION}:/data 
    restart: unless-stopped
    #labels:
    #  - "com.centurylinklabs.watchtower.enable=true"
    #networks:
    #  - proxy    

  immich-machine-learning:
    image: altran1502/immich-machine-learning:v1.87.0
    container_name: immich-ml
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - model-cache:/cache
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    restart: unless-stopped
    #labels:
    #  - "com.centurylinklabs.watchtower.enable=true"
    #networks:
    #  - proxy 

  immich-web:
    image: altran1502/immich-web:v1.87.0
    container_name: immich-web
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    env_file:
      - .env
    restart: unless-stopped
    #labels:
    #  - "com.centurylinklabs.watchtower.enable=true"
    #networks:
    #  - proxy    

  immich-redis:
    container_name: immich-redis
    image: redis:6.2-alpine
    restart: unless-stopped
    #labels:
    #  - "com.centurylinklabs.watchtower.enable=true"
    #networks:
    #  - proxy    

  immich-database:
    container_name: immich-database
    image: postgres:14-alpine
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - ${DB_DATABASE_LOCATION}:/var/lib/postgresql/data
    restart: unless-stopped
    #labels:
    #  - "com.centurylinklabs.watchtower.enable=true"
    #networks:
    #  - proxy    

  immich-proxy:
    container_name: immich-proxy
    image: altran1502/immich-proxy:v1.87.0
    ports:
      - 2283:8080 # WEB UI via proxy; do not remove this proxy service, use it! Even if you have your own reverse proxy.
    depends_on:
      - immich-server
    restart: unless-stopped
    #networks:
    #  - proxy    
    #labels:
    #  - traefik.enable=false
    #  - traefik.http.routers.immich.rule=Host(`immich.example.com`)
    #  - traefik.http.services.immich.loadbalancer.server.port=8080
    #  - traefik.docker.network=proxy
    #  # Part for local lan services only
    #  - traefik.http.routers.immich.middlewares=local-ipwhitelist@file
    #  - "com.centurylinklabs.watchtower.enable=true"
    
volumes:
  model-cache:

#networks:
#  proxy:
#    external: true