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
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build stage
ARG PYTHON_VERSION=3.8
FROM python:${PYTHON_VERSION} AS base
WORKDIR /app
COPY . .
# Runtime stage
FROM python:${PYTHON_VERSION}-slim
WORKDIR /app
ENV PYTHONUNBUFFERED=1
COPY --from=base /app .
RUN pip install --upgrade pip && \
pip install -r requirements.txt
Comment on lines +11 to +12
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing requirement #5: Database migration must be executed as a RUN instruction. Add RUN python manage.py migrate after the pip install commands. Without this, the app will fail because the database tables don't exist.

RUN python manage.py migrate
EXPOSE 8080
CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"]
Comment on lines +2 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 task requirement #3 explicitly states: 'Dockerfile should contain the build stage and run stage.' This Dockerfile only has a single FROM instruction with one stage. You need to implement a multi-stage build with at least two stages - typically a build stage (using a full Python image with build tools) and a run stage (using a slim image).

8 changes: 8 additions & 0 deletions INSTRUCTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Link to my personal Docker Hub repository win an app image:
https://hub.docker.com/repository/docker/nook17n1/todoapp/tags/1.0.0/sha256-e1ae24b5f1dd0effb9631055de04b8677dcc991802429512b18f97d42aacffa3

Instructions for building and running the container.
1. docker build -t todoapp:1.0.0 .
2. docker run -d -p 8080:8080 --name app todoapp:1.0.0

And then start the server in your browser (default is http://localhost:8080).
Loading