Dockerfile.test 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Test image for running backend and frontend tests
  2. FROM python:3.13-slim AS backend-test
  3. WORKDIR /app
  4. # Install system dependencies for testing
  5. RUN apt-get update && apt-get install -y --no-install-recommends \
  6. curl \
  7. && rm -rf /var/lib/apt/lists/*
  8. # Install Python dependencies including test dependencies
  9. COPY requirements.txt ./
  10. COPY requirements-dev.txt ./
  11. RUN pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt
  12. # Copy backend code
  13. COPY backend/ ./backend/
  14. COPY pyproject.toml ./
  15. # Create necessary directories
  16. RUN mkdir -p /app/data /app/logs /app/archive
  17. # Environment variables for testing
  18. ENV PYTHONUNBUFFERED=1
  19. ENV DATA_DIR=/app/data
  20. ENV TESTING=1
  21. # Default command runs pytest (excluding docker integration tests)
  22. CMD ["pytest", "backend/tests/", "-v", "--tb=short", "-p", "no:cacheprovider"]
  23. # -------------------------------------------
  24. # Frontend test stage
  25. FROM node:22-bookworm-slim AS frontend-test
  26. WORKDIR /app/frontend
  27. # Copy package files and install
  28. COPY frontend/package*.json ./
  29. RUN npm ci
  30. # Copy frontend source
  31. COPY frontend/ ./
  32. # Default command runs tests
  33. CMD ["npm", "test", "--", "--run"]