From 0649c84c3b66b69e5bbc5527b82abedb81effbb6 Mon Sep 17 00:00:00 2001 From: Ievgenii Kulyk Date: Fri, 15 Dec 2023 12:55:34 +0200 Subject: [PATCH 1/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2cf1dad..ae915ef 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ or start on the [landing page](http://localhost:8000/) ## Task Create a Dockerfile for the TODO app: +- Fork this repository - TODO App should start inside a container without an error - Dockerfile should contain the build stage and run stage - Add ARG to be used as python base image version in dockerfile From fc4a94282a8c736b1fe26571f66dbf1fdc5db248 Mon Sep 17 00:00:00 2001 From: ykulyk404 Date: Fri, 15 Dec 2023 13:21:30 +0200 Subject: [PATCH 2/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ae915ef..38101f9 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Create a Dockerfile for the TODO app: - `runserver` should be followed by `0.0.0.0:8080` parameter to properly start Django server - Build an image and name it todoapp - An image should be pushed to your personal docker hub account into a repository named “todoapp”, with a tag 1.0.0 (todoapp:1.0.0) +- README.md should contain a link to your personal docker hub repository win an app image - README.md should contain all the instructions on how to build and run the container. - README.md should contain instructions on how to access the application via a browser. - Create PR with your changes and attach it for validation on a platform From eac33a7df04cf616bddd55a597c192d970ec283b Mon Sep 17 00:00:00 2001 From: Alena Tovstukha <106954440+alenatovstukha@users.noreply.github.com> Date: Fri, 15 Dec 2023 13:57:16 +0200 Subject: [PATCH 3/8] [DevOps]: update django todo list task --- README.md | 59 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 38101f9..b06b0f9 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,46 @@ -# Django-Todolist +# Django ToDo list -Django-Todolist is a todolist web application with the most basic features of most web apps, i.e. accounts/login, API and (somewhat) interactive UI. +This is a todo list web application with basic features of most web apps, i.e., accounts/login, API, and interactive UI. To do this task, you will need: ---- -CSS | [Skeleton](http://getskeleton.com/) -JS | [jQuery](https://jquery.com/) +- CSS | [Skeleton](http://getskeleton.com/) +- JS | [jQuery](https://jquery.com/) ## Explore -Try it out by installing the requirements. (Works only with python >= 3.8, due to Django 4) - pip install -r requirements.txt +Try it out by installing the requirements (the following commands work only with Python 3.8 and higher, due to Django 4): + +``` +pip install -r requirements.txt +``` Create a database schema: - python manage.py migrate +``` +python manage.py migrate +``` -And then start the server (default: http://localhost:8000) +And then start the server (default is http://localhost:8000): - python manage.py runserver +``` +python manage.py runserver +``` +Now you can browse the [API](http://localhost:8000/api/) or start on the [landing page](http://localhost:8000/). -Now you can browse the [API](http://localhost:8000/api/) -or start on the [landing page](http://localhost:8000/) +## Task -## Task -Create a Dockerfile for the TODO app: -- Fork this repository -- TODO App should start inside a container without an error -- Dockerfile should contain the build stage and run stage -- Add ARG to be used as python base image version in dockerfile -- Execute db migration as RUN instruction -- Add ENV variable `ENV PYTHONUNBUFFERED=1`. This is needed for optimisation of python app for docker (writing logs directly to stdout and stderr without buffering in the app process memory -- `runserver` should be followed by `0.0.0.0:8080` parameter to properly start Django server -- Build an image and name it todoapp -- An image should be pushed to your personal docker hub account into a repository named “todoapp”, with a tag 1.0.0 (todoapp:1.0.0) -- README.md should contain a link to your personal docker hub repository win an app image -- README.md should contain all the instructions on how to build and run the container. -- README.md should contain instructions on how to access the application via a browser. -- Create PR with your changes and attach it for validation on a platform +Create a `Dockerfile` for the ToDo app: +1. Fork this repository. +1. ToDo app should start inside a container without an error. +1. `Dockerfile` should contain the build stage and run stage. +1. Add `ARG` as Python base image version in `Dockerfile`. +1. Execute database migration as `RUN` instruction. +1. Add the `ENV PYTHONUNBUFFERED=1` variable to optimize the Python app for Docker (writing logs directly to `stdout` and `stderr` without buffering in the app process memory. +1. `runserver` should be followed by the `0.0.0.0:8080` parameter to start the Django server properly. +1. Build an image and name it `todoapp`. +1. The image should be pushed to your personal Docker Hub account into the `todoapp` repository with the `1.0.0` tag (`todoapp:1.0.0`). +1. `README.md` should contain a link to your personal Docker Hub repository win an app image. +1. `README.md` should contain all the instructions for building and running the container. +1. `README.md` should contain instructions on accessing the application via a browser. +1. Create PR with your changes and attach it for validation on a platform. From 9caa77ed535f3297b229dfb57ae0359c05a95859 Mon Sep 17 00:00:00 2001 From: Ievgenii Kulyk Date: Thu, 16 May 2024 13:51:40 +0300 Subject: [PATCH 4/8] Create build-image.yml --- .github/workflows/build-image.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/build-image.yml diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 0000000..c07c458 --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,16 @@ +name: Build Image + +on: + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build the Docker image + run: docker build . --tag task:${{ github.actor }} From e95f6af7e9a206d922394e0d4bbc46416bb5e2a8 Mon Sep 17 00:00:00 2001 From: Sergii Nosachenko <54940595+sergii-nosachenko@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:39:02 +0200 Subject: [PATCH 5/8] Update README.md --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b06b0f9..58a953e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Django ToDo list -This is a todo list web application with basic features of most web apps, i.e., accounts/login, API, and interactive UI. To do this task, you will need: +This is a to-do list web application with basic features of most web apps, i.e., accounts/login, API, and interactive UI. To do this task, you will need: - CSS | [Skeleton](http://getskeleton.com/) - JS | [jQuery](https://jquery.com/) @@ -25,14 +25,14 @@ And then start the server (default is http://localhost:8000): python manage.py runserver ``` -Now you can browse the [API](http://localhost:8000/api/) or start on the [landing page](http://localhost:8000/). +You can now browse the [API](http://localhost:8000/api/) or start on the [landing page](http://localhost:8000/). ## Task Create a `Dockerfile` for the ToDo app: 1. Fork this repository. -1. ToDo app should start inside a container without an error. +1. The ToDo app should start inside a container without an error. 1. `Dockerfile` should contain the build stage and run stage. 1. Add `ARG` as Python base image version in `Dockerfile`. 1. Execute database migration as `RUN` instruction. @@ -40,7 +40,8 @@ Create a `Dockerfile` for the ToDo app: 1. `runserver` should be followed by the `0.0.0.0:8080` parameter to start the Django server properly. 1. Build an image and name it `todoapp`. 1. The image should be pushed to your personal Docker Hub account into the `todoapp` repository with the `1.0.0` tag (`todoapp:1.0.0`). -1. `README.md` should contain a link to your personal Docker Hub repository win an app image. -1. `README.md` should contain all the instructions for building and running the container. -1. `README.md` should contain instructions on accessing the application via a browser. +1. Create the `INSTRUCTION.md` file +1. `INSTRUCTION.md` should contain a link to your personal Docker Hub repository win an app image. +1. `INSTRUCTION.md` should contain all the instructions for building and running the container. +1. `INSTRUCTION.md` should contain instructions on accessing the application via a browser. 1. Create PR with your changes and attach it for validation on a platform. From 8860e644f7ad9455b8312f07de94fdcf44175860 Mon Sep 17 00:00:00 2001 From: Volodymyr Mykychak <ваш_email@example.com> Date: Tue, 19 May 2026 15:17:29 +0000 Subject: [PATCH 6/8] feat: add Dockerfile and instructions --- Dockerfile | 30 ++++++++++++++++++++++++++++++ INSTRUCTION.md | 14 ++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 Dockerfile create mode 100644 INSTRUCTION.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a415747 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +ARG PYTHON_VERSION=3.10-slim + +FROM python:${PYTHON_VERSION} AS builder + +WORKDIR /app + +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 + +COPY requirements.txt . +RUN pip install --no-cache-dir --user -r requirements.txt + +COPY . . + +RUN python manage.py migrate + +FROM python:${PYTHON_VERSION} AS runner + +WORKDIR /app + +ENV PYTHONUNBUFFERED=1 + +COPY --from=builder /root/.local /root/.local +COPY --from=builder /app /app + +ENV PATH=/root/.local/bin:$PATH + +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..285c894 --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,14 @@ +# ToDo Application — Docker Instructions + +This document provides complete instructions on how to build, run, and access the ToDo web application using Docker. + +## Docker Hub Repository +The official pre-built image can be found on Docker Hub: +[https://hub.docker.com/r/tigerob/todoapp](https://hub.docker.com/r/tigerob/todoapp) + +## Local Build Instructions + +To build the Docker image locally, run the following command in the project root directory: + +```bash +docker build -t todoapp . \ No newline at end of file From c8ff72d9b7cf6013ebbb29e9a0fb589dd7a19a36 Mon Sep 17 00:00:00 2001 From: Volodymyr Mykychak <ваш_email@example.com> Date: Tue, 19 May 2026 15:27:42 +0000 Subject: [PATCH 7/8] docs: update INSTRUCTION.md with run, push, and browser steps --- INSTRUCTION.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/INSTRUCTION.md b/INSTRUCTION.md index 285c894..5cc3889 100644 --- a/INSTRUCTION.md +++ b/INSTRUCTION.md @@ -11,4 +11,10 @@ The official pre-built image can be found on Docker Hub: To build the Docker image locally, run the following command in the project root directory: ```bash -docker build -t todoapp . \ No newline at end of file +docker build -t todoapp . +``` +## How to Run the Container + +```bash +docker run -p 8080:8080 todoappdocker build -t todoapp . +``` From b282e9c2573f5f1dc94120e1a677455be5a61153 Mon Sep 17 00:00:00 2001 From: Volodymyr Mykychak <ваш_email@example.com> Date: Tue, 19 May 2026 15:51:46 +0000 Subject: [PATCH 8/8] fix: INSTRUCTION.md according to mentor review --- INSTRUCTION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTRUCTION.md b/INSTRUCTION.md index 5cc3889..a59e1c9 100644 --- a/INSTRUCTION.md +++ b/INSTRUCTION.md @@ -16,5 +16,5 @@ docker build -t todoapp . ## How to Run the Container ```bash -docker run -p 8080:8080 todoappdocker build -t todoapp . +docker run -p 8080:8080 todoapp ```