-
Notifications
You must be signed in to change notification settings - Fork 331
Solution for DevOps ToDo List #316
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| ARG PYTHON_VERSION=3.8 | ||
|
|
||
| FROM python:${PYTHON_VERSION}-slim AS base | ||
| WORKDIR /app | ||
|
|
||
| RUN python -m venv /opt/venv | ||
| ENV PATH="/opt/venv/bin:$PATH" | ||
|
|
||
| COPY requirements.txt . | ||
| RUN pip install --upgrade pip && \ | ||
| pip install --no-cache-dir -r requirements.txt | ||
|
|
||
| COPY . . | ||
|
|
||
| FROM python:${PYTHON_VERSION}-slim | ||
| WORKDIR /app | ||
|
|
||
| ENV PYTHONUNBUFFERED=1 | ||
| ENV PATH="/opt/venv/bin:$PATH" | ||
|
|
||
| COPY --from=base /opt/venv /opt/venv | ||
| COPY --from=base /app /app | ||
|
|
||
| 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,47 @@ | ||
| # Docker Core / Containerizing an App / Docker by practice | ToDo App | ||
|
|
||
| ## Docker Hub Repository | ||
|
|
||
| The application image is available on Docker Hub: | ||
|
|
||
| 🔗 [https://hub.docker.com/repository/docker/maxmlv/todoapp](https://hub.docker.com/repository/docker/maxmlv/todoapp) | ||
|
|
||
| ## Build the Image | ||
|
|
||
| Clone repository and build the image locally: | ||
|
|
||
| ```bash | ||
| git clone https://github.com/maxmlv/devops_todolist.git | ||
| cd devops_todolist | ||
| docker build -t todoapp:1.0.0 . | ||
| ``` | ||
|
|
||
| ## Pull the Image | ||
|
|
||
| Or you can pull the prebuilt image from Docker Hub: | ||
|
|
||
| ```bash | ||
| docker pull maxmlv/todoapp:1.0.0 | ||
| ``` | ||
|
|
||
| ## Run the Container | ||
|
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 |
||
|
|
||
| ```bash | ||
| docker run -d -p 8080:8080 --name todoapp todoapp:1.0.0 | ||
| ``` | ||
|
|
||
| - `-d` — run in detached mode (in the background) | ||
| - `-p 8080:8080` — map container port 8080 to host port 8080 | ||
| - `--name todoapp` — name the running container | ||
|
|
||
|
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 container listens on port 8080 ( |
||
| ## Access the Application | ||
|
|
||
| Once the container is running, open your browser and go to: | ||
|
|
||
| [http://localhost:8080](http://localhost:8080) | ||
|
|
||
| ## Stopping the Container | ||
|
|
||
| ```bash | ||
| docker stop todoapp | ||
| ``` | ||
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
INSTRUCTION.mdto contain instructions for building and running the container. You only describe pulling and running; add a short build section here (for example,docker build -t todoapp:1.0.0 .) so users can build the image from the Dockerfile as well.