-
Notifications
You must be signed in to change notification settings - Fork 331
Completed solution on Dockerfile and instructions #327
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ARG PYTHON_VERSION=3.9-slim | ||
| FROM python:${PYTHON_VERSION} AS builder | ||
|
|
||
| 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 instructions use |
||
| RUN python -m venv /opt/venv | ||
| ENV PATH="/opt/venv/bin:$PATH" | ||
|
|
||
| COPY requirements.txt . | ||
| RUN pip install -r requirements.txt | ||
|
|
||
| COPY . . | ||
| RUN python manage.py migrate | ||
|
|
||
| FROM python:${PYTHON_VERSION} | ||
|
|
||
| ENV PYTHONUNBUFFERED=1 | ||
| ENV PATH="/opt/venv/bin:$PATH" | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY --from=builder /opt/venv /opt/venv | ||
| COPY --from=builder /app . | ||
|
|
||
| EXPOSE 8080 | ||
|
|
||
| CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| [Docker Image](https://hub.docker.com/r/somewellich/todoapp) | ||
|
|
||
| ## Instructions for building and running the container | ||
|
|
||
| 1. First, build the local image named exactly `todoapp`: | ||
| ``` bash | ||
| docker build -t todoapp . | ||
| ``` | ||
| Next, we need to add a tag with the personal Docker Hub namespace. | ||
| Explanation: `todoapp` is the local image name. `somewellich/todoapp:1.0.0` is the namespaced repository tag required by Docker Hub to know where to upload the image and what version it is. | ||
|
|
||
| ```bash | ||
| docker tag todoapp somewellich/todoapp:1.0.0 | ||
| ``` | ||
| Run the container: | ||
|
|
||
| ```bash | ||
| docker run -d -p 8080:8080 somewellich/todoapp:1.0.0 | ||
| ``` | ||
| ## Instructions on accessing the application via a browser | ||
|
|
||
| http://localhost:8080/ | ||
|
|
||
| OR | ||
|
|
||
| [http://127.0.0.1:8080/](http://127.0.0.1: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.
The task requires that the built image be named
todoappand pushed astodoapp:1.0.0; your Dockerfile does not enforce a tag, so ensure your build and push commands (documented in INSTRUCTION.md) clearly align with this requirement and mention the baretodoappname if expected.