# Test-only image — the app's Python deps + pytest/ruff, and NOTHING else. Code is bind-mounted at # run time (not baked), so pytest always sees the working tree, and this file never touches the prod # Dockerfile, so the published image can never carry test tooling. Same python + same pinned # requirements.txt as the runtime stage, so tests run against the prod dependency set. Rebuilt only # when a requirements file changes (the pip layer is cache-keyed on them); otherwise a no-op. # # docker build -f backend/Dockerfile.test -t siftlode-test:local backend # docker run --rm -v "/backend:/app" -w /app siftlode-test:local python -m pytest FROM python:3.12-slim WORKDIR /app # ffmpeg so the thumbnail/poster tests (needs_ffmpeg) actually run in the gate instead of skipping # silently — the runtime image already ships ffmpeg, so the test image should too (see conftest's # SIFTLODE_TEST_REQUIRE_DB, which now also refuses to run if ffmpeg is missing). RUN apt-get update \ && apt-get install -y --no-install-recommends ffmpeg \ && rm -rf /var/lib/apt/lists/* # Install the SAME pinned lock as the prod image (+ the test-only tooling), so the tests run against # the exact dependency versions prod ships. COPY requirements.lock requirements-dev.txt ./ RUN pip install --no-cache-dir -r requirements.lock -r requirements-dev.txt