diff --git a/backend/tests/Dockerfile.test b/backend/tests/Dockerfile.test index 2340936..6cacba4 100644 --- a/backend/tests/Dockerfile.test +++ b/backend/tests/Dockerfile.test @@ -1,20 +1,20 @@ # Use an official Python runtime as a parent image -FROM python:3.9-slim +FROM python:3.12-slim -# Set the working directory in the container +# Set the working directory to /app WORKDIR /app -# Set environment variable to ensure unbuffered output (for better logging) -ENV PYTHONUNBUFFERED 1 +# Copy the requirements file from the root directory to the container +COPY ../requirements.txt /app/requirements.txt -# Copy the requirements file into the container -COPY requirements.txt /app/requirements.txt - -# Install dependencies (including coverage) +# Install dependencies including 'coverage' RUN pip install --no-cache-dir -r /app/requirements.txt coverage -# Copy the entire codebase into the container -COPY . /app/ +# Copy the application code into the container +COPY . /app + +# Expose the application port (optional, if you plan to run it with a server) +EXPOSE 8000 -# Run the tests with coverage -CMD ["python", "manage.py", "test", "--coverage", "--coverage-report=coverage.xml"] +# Run tests with coverage and generate a report +CMD ["sh", "-c", "coverage run --source='.' manage.py test && coverage report"]