From 46fcf1bb1f62e86767bd2d49ab6041bfc3f6ccf2 Mon Sep 17 00:00:00 2001 From: Bogdan K Date: Fri, 26 Jun 2026 20:18:17 +0300 Subject: [PATCH 1/2] add Dockerfile and instructions --- Dockerfile | 26 ++++++++++++++++++++++++++ INSTRUCTION.md | 30 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 Dockerfile create mode 100644 INSTRUCTION.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..01ed09f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +ARG PYTHON_VERSION=3.11 + +FROM python:${PYTHON_VERSION} AS builder + +WORKDIR /app + +COPY requirements.txt . + +RUN pip install --user -r requirements.txt + +COPY . . + +FROM python:${PYTHON_VERSION}-slim + +WORKDIR /app + +COPY --from=builder /root/.local /root/.local + +COPY --from=builder /app . + +ENV PATH=/root/.local/bin:$PATH +ENV PYTHONUNBUFFERED=1 + +RUN python manage.py migrate + +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..063b3bc --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,30 @@ +ToDo App Docker Instructions + +1. Docker Hub Repository +The pre-built image is available at the following link: +https://hub.docker.com/r/trickykot3/todoapp + +2. Build Instructions +To build the image locally, run the following command in the root directory of the project: + +docker build -t trickykot3/todoapp:1.0.0 . + +Changing the Python version: +You can specify a different base Python version using a build argument. +(Warning: Changing the version may cause some features to work incorrectly or break the application. The default version is set to 3.11). + +docker build --build-arg PYTHON_VERSION= -t trickykot3/todoapp:1.0.0 . + +3. Run Instructions +To start the container and map the required ports, use the following command: + +docker run -p 8080:8080 --name trickykot3/todoapp:1.0.0 + +Running in detached (background) mode: +If you want to run the container in the background, add the -d flag: + +docker run -d -p 8080:8080 --name trickykot3/todoapp:1.0.0 + +4. Accessing the Application +Once the container is up and running, you can access the application via your web browser at: +http://localhost:8080 \ No newline at end of file From ee3e834be5cf6be88b2b01ad025917b9bb8ff4f9 Mon Sep 17 00:00:00 2001 From: Bogdan K Date: Fri, 26 Jun 2026 20:23:33 +0300 Subject: [PATCH 2/2] docs: update instructions for compliance --- INSTRUCTION.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/INSTRUCTION.md b/INSTRUCTION.md index 063b3bc..bab82e7 100644 --- a/INSTRUCTION.md +++ b/INSTRUCTION.md @@ -5,25 +5,24 @@ The pre-built image is available at the following link: https://hub.docker.com/r/trickykot3/todoapp 2. Build Instructions -To build the image locally, run the following command in the root directory of the project: +Build for local use: -docker build -t trickykot3/todoapp:1.0.0 . +docker build -t todoapp . -Changing the Python version: -You can specify a different base Python version using a build argument. -(Warning: Changing the version may cause some features to work incorrectly or break the application. The default version is set to 3.11). +Build for pushing to Docker Hub: -docker build --build-arg PYTHON_VERSION= -t trickykot3/todoapp:1.0.0 . +docker build -t trickykot3/todoapp:1.0.0 . 3. Run Instructions -To start the container and map the required ports, use the following command: +Run the local image: + +docker run -p 8080:8080 --name my_todo_app todoapp -docker run -p 8080:8080 --name trickykot3/todoapp:1.0.0 +Run the image from Docker Hub: -Running in detached (background) mode: -If you want to run the container in the background, add the -d flag: +docker run -p 8080:8080 --name my_todo_app trickykot3/todoapp:1.0.0 -docker run -d -p 8080:8080 --name trickykot3/todoapp:1.0.0 +(Note: The todoapp and trickykot3/todoapp:1.0.0 tags refer to the same build; the only difference is the naming convention for local testing vs. registry deployment.) 4. Accessing the Application Once the container is up and running, you can access the application via your web browser at: