Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ARG PYTHON_VERSION=3.10
FROM python:${PYTHON_VERSION} AS base

WORKDIR /app

COPY requirements.txt .

Comment on lines +6 to +7
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: The Docker Hub URL (line 6) uses Clem97121 while the Full Image Path (line 7) uses clem97121. Usernames are effectively case-insensitive on Docker Hub, but please use a consistent casing (prefer lowercase) in the instructions to avoid confusion.

RUN pip install --user --no-cache-dir -r requirements.txt

FROM python:${PYTHON_VERSION}-slim AS runner

ENV PYTHONUNBUFFERED=1

WORKDIR /app

Comment on lines +14 to +15
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The INSTRUCTION.md provides a local build command but does not tag the image as 1.0.0 nor shows how to push to your Docker Hub repository. The task requires the image be pushed to your Docker Hub repo as todoapp:1.0.0. Update the instructions to build with the correct tag (for example docker build -t <your-dockerhub-username>/todoapp:1.0.0 .) and add steps to docker push the resulting image to your Docker Hub repository.

Comment on lines +11 to +15
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INSTRUCTION.md is missing instructions to run the container and how to access the application via a browser. Add a docker run example that maps the container port 8080 to a host port (for example docker run -p 8080:8080 <your-dockerhub-username>/todoapp:1.0.0) and a note that the app will be reachable at http://localhost:8080 after the container starts.

COPY --from=base /root/.local /root/.local

COPY . .

ENV PATH=/root/.local/bin:$PATH

RUN python manage.py migrate
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dockerfile includes RUN python manage.py migrate (as required). Note: running migrations at image build time will succeed only if the project uses a local DB (e.g. default SQLite). If the app expects an external DB, this RUN will fail during build — ensure your Django settings allow migrations at build time or consider running migrations at container start. The task explicitly required a RUN migration, so keep this in mind.


EXPOSE 8080

CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"]
46 changes: 46 additions & 0 deletions INSTRUCTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
ToDo Application - Docker Instructions
This project is a Django-based ToDo application containerized using a multi-stage Dockerfile.

1. Docker Hub Repository
The official image for this application is published at:
Link: https://hub.docker.com/r/Clem97121/todoapp
Full Image Path: clem97121/todoapp:1.0.0

2. How to Build and Tag the Image
To build the image and apply the required tag for your personal repository, run the following command from the project root:

Bash
docker build -t clem97121/todoapp:1.0.0 .
Note: Database migrations (python manage.py migrate) are executed as a RUN instruction during the build stage. This assumes the project uses a local SQLite database.

3. How to Push the Image to Docker Hub
To publish the image to your personal Docker Hub account, execute these commands:

Login to your account:

Bash
docker login
Push the specific tag:

Bash
docker push clem97121/todoapp:1.0.0
4. How to Run the Container
To start the application locally after pulling or building the image, use:

Bash
docker run -d -p 8080:8080 --name todoapp clem97121/todoapp:1.0.0
5. How to Access the Application
Once the container is running, the application is accessible via browser at:

Main Landing Page: http://localhost:8080/

API Documentation: http://localhost:8080/api/

6. Technical Specifications
Multi-stage build: Implemented to optimize the final image size.

Python Version: Controlled via ARG PYTHON_VERSION.

Log Optimization: ENV PYTHONUNBUFFERED=1 is used to ensure real-time logging to stdout/stderr.

Network: The Django server is configured to run on 0.0.0.0:8080.
Loading