services:
  app:
    image: 'viktorstrate/photoview:2.4.0'
    restart: 'always'

    depends_on:
      db:
        condition: service_healthy

    environment:
      PHOTOVIEW_DATABASE_DRIVER: 'postgres'
      PHOTOVIEW_POSTGRES_URL: 'postgres://photoview:photoview@db/photoview?sslmode=disable'
    ports:
      - '8012:80'
    volumes:
      - '/etc/localtime:/etc/localtime:ro'
      - '/etc/timezone:/etc/timezone:ro'
      - '/mnt/data1/photoview/cache:/home/photoview/media-cache'
      - '/mnt/data1/photos:/photos:ro'

  db:
    image: 'postgres:17.0-alpine'
    restart: 'always'

    healthcheck:
      test: ["CMD", "pg_isready", "-U", "photoview"]
      interval: 10s
      start_period: 30s

    environment:
      POSTGRES_USER: 'photoview'
      POSTGRES_PASSWORD: 'photoview'
      POSTGRES_DB: 'photoview'
    volumes:
      - '/mnt/data1/photoview/postgres:/var/lib/postgresql/data'
