Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Dockerfile
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task requires INSTRUCTION.md to 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.

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"]
47 changes: 47 additions & 0 deletions INSTRUCTION.md
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task requires INSTRUCTION.md to include building instructions as well as running; here you only show how to pull and run the image, so add a docker build example (e.g., docker build -t todoapp:1.0.0 .) before or near this section.


```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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The container listens on port 8080 (runserver 0.0.0.0:8080), but this line exposes 8000, which is inconsistent and may confuse users; change this to EXPOSE 8080 to match the actual application port and your run instructions.

## 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
```
Loading