# Test-only Dockerfile for backend FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ gcc \ postgresql-client \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install dependencies COPY requirements.txt requirements-test.txt ./ RUN pip install --no-cache-dir -r requirements.txt && \ pip install --no-cache-dir -r requirements-test.txt # Copy application code COPY . . # Create non-root user RUN groupadd --gid 1001 appgroup && \ useradd --uid 1001 --gid appgroup --shell /bin/bash --create-home appuser && \ chown -R appuser:appgroup /app USER appuser # Default command for tests CMD ["pytest", "tests/", "-v", "--cov=backend", "--cov-report=html", "--cov-report=term"]