-
Notifications
You must be signed in to change notification settings - Fork 331
Solution #326
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 #326
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,28 @@ | ||
| ARG PYTHON_VERSION=3.11 | ||
| FROM python:${PYTHON_VERSION} AS build | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY . . | ||
|
|
||
| RUN python -m venv venv | ||
| ENV PATH="/app/venv/bin:$PATH" | ||
|
|
||
| RUN pip install --upgrade pip && \ | ||
| pip install --no-cache-dir -r requirements.txt | ||
|
|
||
|
|
||
| FROM python:${PYTHON_VERSION}-slim AS run | ||
|
|
||
| WORKDIR /app | ||
| ENV 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 checklist requires building and pushing an image named |
||
|
|
||
| COPY --from=build /app /app | ||
|
|
||
| ENV PATH="/app/venv/bin:$PATH" | ||
| RUN python manage.py migrate | ||
|
|
||
| EXPOSE 8080 | ||
|
|
||
| ENTRYPOINT ["python", "manage.py", "runserver"] | ||
| CMD ["0.0.0.0:8080"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # ToDo App — Docker Instructions | ||
|
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. |
||
|
|
||
| ## Docker Hub Repository | ||
|
|
||
| The image is available on Docker Hub: | ||
| https://hub.docker.com/r/olehkovalievskyi/todoapp | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Docker installed on your machine | ||
| - (Optional) Docker Hub account, if you want to pull the pre-built image | ||
|
|
||
| ## Build the image locally | ||
|
|
||
| Clone the repository and navigate to its root directory, then run: | ||
|
|
||
| ```bash | ||
| docker build -t todoapp:1.0.0 . | ||
| ``` | ||
|
|
||
| ## Run the container | ||
|
|
||
| ```bash | ||
| docker run -d -p 8080:8080 --name todoapp-container todoapp:1.0.0 | ||
| ``` | ||
|
|
||
| Alternatively, you can pull and run the pre-built image directly from Docker Hub: | ||
|
|
||
| ```bash | ||
| docker pull olehkovalievskyi/todoapp:1.0.0 | ||
| docker run -d -p 8080:8080 --name todoapp-container olehkovalievskyi/todoapp:1.0.0 | ||
| ``` | ||
|
|
||
| ## Stopping the container | ||
|
|
||
| ```bash | ||
| docker stop todoapp-container | ||
| ``` | ||
|
|
||
| ## Access the application | ||
|
|
||
| Once the container is running, open your browser and navigate to: | ||
|
|
||
| http://localhost:8080 | ||
|
|
||
| ## Notes | ||
|
|
||
| - The application listens on `0.0.0.0:8080` inside the container. | ||
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 show building the image as
todoappwithout a version tag; since the description explicitly calls for pushingtodoapp:1.0.0to Docker Hub, consider adding a build example with that tag (e.g.,docker build -t todoapp:1.0.0 .) to fully reflect checklist item #10.