# Finder scraper image. Runs via docker-compose sharing the media_gluetun VPN
# network namespace; the source tree is bind-mounted at runtime, so this image
# only needs the Python deps. The venv lives OUTSIDE the bind-mount target
# (/opt/venv) so the mount doesn't shadow it.
FROM python:3.12-slim

ENV UV_PROJECT_ENVIRONMENT=/opt/venv \
    UV_COMPILE_BYTECODE=1 \
    UV_LINK_MODE=copy \
    PYTHONUNBUFFERED=1

RUN apt-get update \
  && apt-get install -y --no-install-recommends ca-certificates curl \
  && rm -rf /var/lib/apt/lists/*

COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

WORKDIR /app/finder

# Install dependencies into /opt/venv (cached layer; project code is mounted at runtime).
COPY pyproject.toml uv.lock ./
RUN uv sync --no-install-project --frozen

# Source is bind-mounted over /app/finder by compose. `uv run` uses /opt/venv.
CMD ["sleep", "infinity"]
