-
Notifications
You must be signed in to change notification settings - Fork 305
Solution #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Solution #291
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| RUN python manage.py migrate | ||
| EXPOSE 8080 | ||
| CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"] | ||
|
Comment on lines
+2
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). |
||
| 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). |
There was a problem hiding this comment.
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
RUNinstruction. AddRUN python manage.py migrateafter the pip install commands. Without this, the app will fail because the database tables don't exist.