forked from mathialm/secfit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
CodingGirlGargi
committed
Apr 3, 2025
1 parent
647c3d9
commit 8700f98
Showing
1 changed file
with
13 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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"] |