From 73c43ccf29083ba508d4d048fdd61997ab7ffc43 Mon Sep 17 00:00:00 2001 From: ten4i Date: Fri, 17 Apr 2026 19:07:24 +0000 Subject: [PATCH 1/5] my sollution --- Dockerfile | 17 +++++++++++++++++ INSTRUCTION.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Dockerfile create mode 100644 INSTRUCTION.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7e75a48 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +ARG PYTHON_VERSION=3.11 + +#build stage +FROM python:${PYTHON_VERSION}-slim AS builder +WORKDIR /app +COPY requirements.txt . +RUN pip install -r requirements.txt + +#run stage +FROM python:${PYTHON_VERSION}-slim +WORKDIR /app +ENV PYTHONUNBUFFERED=1 +EXPOSE 8080 +COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages +COPY . . +RUN python manage.py migrate +CMD [ "python" , "manage.py", "runserver", "0.0.0.0:8080"] diff --git a/INSTRUCTION.md b/INSTRUCTION.md new file mode 100644 index 0000000..84c41fc --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,32 @@ +# ToDo App — Docker Instructions + +## Docker Hub Repository + +https://hub.docker.com/r/ten4i/todoapp + +## Build the image + +```bash +docker build -t todoapp:1.0.0 . +``` + +## Run the container + +```bash +docker run -d -p 8080:8080 todoapp:1.0.0 +``` + +## Access the application + +Open your browser and go to: + +``` +http://localhost:8080 +``` + +## Pull and run from Docker Hub + +```bash +docker pull ten4i/todoapp:1.0.0 +docker run -d -p 8080:8080 ten4i/todoapp:1.0.0 +``` From 3a20be41233e793919b45adb6675df050537c936 Mon Sep 17 00:00:00 2001 From: ten4i Date: Sat, 18 Apr 2026 09:25:30 +0000 Subject: [PATCH 2/5] added push instructions.md and added username in a build stage --- Dockerfile | 14 ++++++++++---- INSTRUCTION.md | 7 ++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7e75a48..eed6efc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,23 @@ ARG PYTHON_VERSION=3.11 #build stage -FROM python:${PYTHON_VERSION}-slim AS builder +FROM python:${PYTHON_кеVERSION}-slim as builder + WORKDIR /app + COPY requirements.txt . RUN pip install -r requirements.txt #run stage FROM python:${PYTHON_VERSION}-slim + WORKDIR /app + ENV PYTHONUNBUFFERED=1 -EXPOSE 8080 -COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages + +COPY --from=builder /root/.local /root/.local COPY . . -RUN python manage.py migrate + +EXPOSE 8080 + CMD [ "python" , "manage.py", "runserver", "0.0.0.0:8080"] diff --git a/INSTRUCTION.md b/INSTRUCTION.md index 84c41fc..f5848b3 100644 --- a/INSTRUCTION.md +++ b/INSTRUCTION.md @@ -7,7 +7,7 @@ https://hub.docker.com/r/ten4i/todoapp ## Build the image ```bash -docker build -t todoapp:1.0.0 . +docker build -t ten4i/todoapp:1.0.0 . ``` ## Run the container @@ -26,7 +26,8 @@ http://localhost:8080 ## Pull and run from Docker Hub -```bash -docker pull ten4i/todoapp:1.0.0 +```bashas +docker push ten4i/todoapp:1.0.0 +docker Pull ten4i/todoapp:1.0.0 docker run -d -p 8080:8080 ten4i/todoapp:1.0.0 ``` From 2362b663721561a6839644e17cf0281f1606296b Mon Sep 17 00:00:00 2001 From: ten4i Date: Sat, 18 Apr 2026 09:29:35 +0000 Subject: [PATCH 3/5] fixed typo in a dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index eed6efc..4cf59ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG PYTHON_VERSION=3.11 #build stage -FROM python:${PYTHON_кеVERSION}-slim as builder +FROM python:${PYTHON_VERSION}-slim as builder WORKDIR /app From 48bc27b7d296db82667de7b5ec08e2effacf5545 Mon Sep 17 00:00:00 2001 From: ten4i Date: Sat, 18 Apr 2026 13:09:32 +0000 Subject: [PATCH 4/5] fixed typo --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4cf59ac..60125c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG PYTHON_VERSION=3.11 #build stage -FROM python:${PYTHON_VERSION}-slim as builder +FROM python:${PYTHON_VERSION}-slim AS builder WORKDIR /app @@ -20,4 +20,4 @@ COPY . . EXPOSE 8080 -CMD [ "python" , "manage.py", "runserver", "0.0.0.0:8080"] +CMD [ "python" , "manage.py", "runserver", "0.0.0.0:8080"] From 13de980589d913deaaae35b70d03d732e0186fa8 Mon Sep 17 00:00:00 2001 From: ten4i Date: Sat, 18 Apr 2026 13:26:04 +0000 Subject: [PATCH 5/5] fixed and adding path --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 60125c0..2e2ea00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ FROM python:${PYTHON_VERSION}-slim AS builder WORKDIR /app COPY requirements.txt . -RUN pip install -r requirements.txt +RUN pip install --user -r requirements.txt #run stage FROM python:${PYTHON_VERSION}-slim @@ -14,6 +14,7 @@ FROM python:${PYTHON_VERSION}-slim WORKDIR /app ENV PYTHONUNBUFFERED=1 +ENV PATH="/root/.local/bin:$PATH" COPY --from=builder /root/.local /root/.local COPY . .