From e53724bcb409f99ef55a847dc86d39622e9db895 Mon Sep 17 00:00:00 2001 From: Alexandr Date: Fri, 8 May 2026 05:17:20 +0300 Subject: [PATCH 1/4] Solution --- Dockerfile | 10 ++++++++++ INSTRUCTION.md | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 Dockerfile create mode 100644 INSTRUCTION.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..092dff7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +ARG PYTHON_VERSION=3.8 +FROM python:${PYTHON_VERSION} +WORKDIR /app +COPY requirements.txt . +RUN pip install -r requirements.txt +COPY . . +RUN python manage.py migrate +ENV PYTHONUNBUFFERED=1 +EXPOSE 8080 +CMD ["python", "manage.py", "runserver", "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..6d8ff97 --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,8 @@ +Link to my personal Docker Hub repository win an app image: +https://hub.docker.com/repository/docker/nook17n1/todoapp/tags/1.0.0/sha256-9d2dd6fd3a7f772e7e992e13936174c62d55d10b11d8bb66b70b9044539081a6 + +Instructions for building and running the container. +1. docker build -t todoapp:1.0.0 . +2. docker run -d -p 8080:8080 --name app todoapp:1.0.0 + +And then start the server in your browser (default is http://localhost:8080). \ No newline at end of file From cc81d23f12a54809161cfd0173ee92a634f2f2c7 Mon Sep 17 00:00:00 2001 From: Alexandr Date: Fri, 8 May 2026 05:50:31 +0300 Subject: [PATCH 2/4] Solution1 --- Dockerfile | 12 ++++++++---- INSTRUCTION.md | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 092dff7..93643eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,14 @@ +# Build stage ARG PYTHON_VERSION=3.8 -FROM python:${PYTHON_VERSION} +FROM python:${PYTHON_VERSION} AS base WORKDIR /app -COPY requirements.txt . -RUN pip install -r requirements.txt COPY . . -RUN python manage.py migrate +# Runtime stage +FROM python:${PYTHON_VERSION}-slim +WORKDIR /app ENV PYTHONUNBUFFERED=1 +COPY --from=base /app . +RUN pip install --upgrade pip && \ +pip install -r requirements.txt EXPOSE 8080 CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"] \ No newline at end of file diff --git a/INSTRUCTION.md b/INSTRUCTION.md index 6d8ff97..ff65309 100644 --- a/INSTRUCTION.md +++ b/INSTRUCTION.md @@ -1,5 +1,5 @@ Link to my personal Docker Hub repository win an app image: -https://hub.docker.com/repository/docker/nook17n1/todoapp/tags/1.0.0/sha256-9d2dd6fd3a7f772e7e992e13936174c62d55d10b11d8bb66b70b9044539081a6 +https://hub.docker.com/repository/docker/nook17n1/todoapp/tags/1.0.0/sha256-e1ae24b5f1dd0effb9631055de04b8677dcc991802429512b18f97d42aacffa3 Instructions for building and running the container. 1. docker build -t todoapp:1.0.0 . From 577e89be7a564a8fd7c35e79c32cbc14fc2f8795 Mon Sep 17 00:00:00 2001 From: Alexandr Date: Fri, 8 May 2026 05:57:15 +0300 Subject: [PATCH 3/4] Solution2 --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 93643eb..c445ec5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,5 +10,6 @@ ENV PYTHONUNBUFFERED=1 COPY --from=base /app . RUN pip install --upgrade pip && \ pip install -r requirements.txt +RUN python manage.py EXPOSE 8080 CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"] \ No newline at end of file From 00e0d2071728df109d1d6c4c37beb1ed8a604427 Mon Sep 17 00:00:00 2001 From: Alexandr Date: Fri, 8 May 2026 05:59:48 +0300 Subject: [PATCH 4/4] Solution3 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c445ec5..ee6480c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,6 @@ ENV PYTHONUNBUFFERED=1 COPY --from=base /app . RUN pip install --upgrade pip && \ pip install -r requirements.txt -RUN python manage.py +RUN python manage.py migrate EXPOSE 8080 CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"] \ No newline at end of file