From 32171b943b912c960694af684701f2383c953ec3 Mon Sep 17 00:00:00 2001 From: Oleh K Date: Fri, 3 Jul 2026 15:38:49 +0200 Subject: [PATCH 1/3] Solution --- Dockerfile | 28 ++++++++++++++++++++++++++++ INSTRUCTION.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 Dockerfile create mode 100644 INSTRUCTION.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..97d4273 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +ARG PYTHON_VERSION=3.14 +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 + +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"] \ No newline at end of file diff --git a/INSTRUCTION.md b/INSTRUCTION.md new file mode 100644 index 0000000..2c07e63 --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,48 @@ +# ToDo App — Docker Instructions + +## 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 . +``` + +## Run the container + +```bash +docker run -d -p 8080:8080 --name todoapp-container todoapp +``` + +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. \ No newline at end of file From 0e37decbd1a7adccb84f5bde843af9cf40715bf5 Mon Sep 17 00:00:00 2001 From: Oleh K Date: Fri, 3 Jul 2026 15:52:50 +0200 Subject: [PATCH 2/3] upd: set python version 3.11 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 97d4273..bb53e44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG PYTHON_VERSION=3.14 +ARG PYTHON_VERSION=3.11 FROM python:${PYTHON_VERSION} AS build WORKDIR /app From d8f6561d30e46856ca44903d335fa93be769f82c Mon Sep 17 00:00:00 2001 From: Oleh K Date: Fri, 3 Jul 2026 15:56:04 +0200 Subject: [PATCH 3/3] upd: edited build tag in instruction.md --- INSTRUCTION.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTRUCTION.md b/INSTRUCTION.md index 2c07e63..eba5cef 100644 --- a/INSTRUCTION.md +++ b/INSTRUCTION.md @@ -15,13 +15,13 @@ https://hub.docker.com/r/olehkovalievskyi/todoapp Clone the repository and navigate to its root directory, then run: ```bash -docker build -t todoapp . +docker build -t todoapp:1.0.0 . ``` ## Run the container ```bash -docker run -d -p 8080:8080 --name todoapp-container todoapp +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: