From be9aa93c424053fa8cc1b8a82b2274046770ff23 Mon Sep 17 00:00:00 2001 From: Gargi Ketan Chauhan Date: Wed, 2 Apr 2025 12:10:25 +0200 Subject: [PATCH] Update Dockerfile --- backend/Dockerfile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 6a40cc3..1884a5f 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,12 +1,15 @@ +# 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", "python manage.py migrate && 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"]