From 8700f98089107626e824fb9e1da3655c40f383c9 Mon Sep 17 00:00:00 2001 From: CodingGirlGargi Date: Thu, 3 Apr 2025 22:31:58 +0200 Subject: [PATCH] added all the testcases --- backend/tests/Dockerfile.test | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/backend/tests/Dockerfile.test b/backend/tests/Dockerfile.test index 7c28661..3890ed7 100644 --- a/backend/tests/Dockerfile.test +++ b/backend/tests/Dockerfile.test @@ -1,16 +1,20 @@ -# We Use an official Python runtime as a parent image +# Use an official Python runtime as a parent image FROM python:3.12-slim -# Allows docker to cache installed dependencies between builds -COPY requirements.txt requirements.txt -RUN pip install --no-cache-dir -r requirements.txt +# Set the working directory to /app +WORKDIR /app + +# Copy the requirements file from the root directory to the container +COPY ../requirements.txt /app/requirements.txt -# Mounts the application code to the image -RUN mkdir /app +# Install dependencies including 'coverage' +RUN pip install --no-cache-dir -r /app/requirements.txt coverage + +# Copy the application code into the container COPY . /app -WORKDIR /app +# Expose the application port (optional, if you plan to run it with a server) EXPOSE 8000 -# Runs migrations and starts the server -CMD ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"] +# Run tests with coverage and generate a report +CMD ["sh", "-c", "coverage run --source='.' manage.py test && coverage report"] \ No newline at end of file