-
Notifications
You must be signed in to change notification settings - Fork 331
Added solution #317
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
Added solution #317
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,25 @@ | ||
| ARG PYTHON_VERSION=3.13-slim | ||
| FROM python:${PYTHON_VERSION} AS builder | ||
| WORKDIR /build | ||
|
|
||
| RUN python -m venv /opt/venv | ||
| ENV PATH="/opt/venv/bin:$PATH" \ | ||
| PYTHONUNBUFFERED=1 | ||
|
|
||
| COPY requirements.txt . | ||
| RUN pip install -r requirements.txt | ||
|
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 requirements state that the image must be pushed as 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. Here you build the image as |
||
|
|
||
|
|
||
| FROM python:${PYTHON_VERSION} AS runtime | ||
| WORKDIR /app | ||
|
|
||
|
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 app is supposed to run on port 8080 (per the required |
||
| COPY --from=builder /opt/venv /opt/venv | ||
|
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. This |
||
| ENV PATH="/opt/venv/bin:$PATH" \ | ||
| PYTHONUNBUFFERED=1 | ||
|
|
||
|
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 Docker Hub link should point to the repository/image that contains the required |
||
| COPY . . | ||
|
|
||
| RUN python manage.py migrate | ||
|
|
||
| ENTRYPOINT ["python"] | ||
| CMD ["manage.py", "runserver", "0.0.0.0:8080"] | ||
|
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. Since the requirement is to push the |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # How to run the app | ||
|
|
||
| ## 1. Install Docker | ||
|
|
||
| Download and install Docker for your OS: https://docs.docker.com/get-docker/ | ||
|
|
||
| ## 2. Build the image | ||
|
|
||
| ``` | ||
| docker build -t todoapp:1.0.0 . | ||
|
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 requires building an image named |
||
| ``` | ||
|
|
||
| ## 3. Tag and push to Docker Hub | ||
|
|
||
| ``` | ||
| docker tag todoapp:1.0.0 666phx/todoapp:1.0.0 | ||
| docker push 666phx/todoapp:1.0.0 | ||
| ``` | ||
|
|
||
| ## 4. Run the container | ||
|
|
||
| ``` | ||
| docker run -d -p 8080:8080 666phx/todoapp:1.0.0 | ||
|
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. Here you run |
||
| ``` | ||
|
|
||
| ## 5. Open in browser | ||
|
|
||
| Go to: http://localhost:8080 | ||
|
|
||
| --- | ||
|
|
||
| Docker Hub image: https://hub.docker.com/r/666phx/todoapp/tags | ||
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.
The instructions must include how to build the image and run the container, but currently you only show a
docker runcommand. Add steps for building (e.g.,docker build -t todoapp .), tagging astodoapp:1.0.0, and pushing to Docker Hub so you cover the full workflow required by the task.