From 716f57a1d6489744ced726c32a73362be9227fba Mon Sep 17 00:00:00 2001 From: Garima Ketan Chauhan Date: Wed, 2 Apr 2025 12:08:08 +0200 Subject: [PATCH] Update Dockerfile.test --- backend/tests/Dockerfile.test | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/tests/Dockerfile.test b/backend/tests/Dockerfile.test index 15b9b70..1884a5f 100644 --- a/backend/tests/Dockerfile.test +++ b/backend/tests/Dockerfile.test @@ -1,13 +1,15 @@ -# dockerfile.test +# We 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 -RUN pip install coverage - -RUN mkdir /app -COPY . /app +# Mounts the application code to the image +COPY . app WORKDIR /app -CMD ["sh", "-c", "coverage run --source='.' manage.py test && coverage report"] +EXPOSE 8000 + +# Runs migrations and starts the production server +CMD ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"]