# Local development dependencies only (Postgres + MinIO).
# Run the app itself with `cargo run --bin server` / `cargo run --bin worker`
# and `npm run dev` in frontend/ (see README).
services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_USER: photos
      POSTGRES_PASSWORD: photos
      POSTGRES_DB: photos
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data

  minio:
    image: minio/minio
    command: server /data --console-address ":9001"
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin
    ports:
      - "9000:9000"
      - "9001:9001"
    volumes:
      - miniodata:/data

  minio-init:
    image: minio/mc
    depends_on:
      - minio
    entrypoint: >
      /bin/sh -c "
      until mc alias set local http://minio:9000 minioadmin minioadmin; do sleep 1; done;
      mc mb -p local/photos;
      exit 0"

volumes:
  pgdata:
  miniodata:
