From 9d9fd81683345acfc86ac992fe712e45e23687b0 Mon Sep 17 00:00:00 2001 From: Garima Ketan Chauhan Date: Thu, 3 Apr 2025 00:04:42 +0200 Subject: [PATCH] Update Dockerfile.test --- backend/tests/Dockerfile.test | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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"]