From 19c3c7866b55a377279b3917d185077123b0c16e Mon Sep 17 00:00:00 2001 From: Tetiana Savenko Date: Mon, 25 May 2026 14:42:02 +0300 Subject: [PATCH 1/2] 'Solution' --- Dockerfile | 13 +++++++++++++ INSTRUCTION.md | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Dockerfile create mode 100644 INSTRUCTION.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..02ebc22 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +ARG python_version=3.14 +FROM python:${python_version} AS builder +WORKDIR /app +COPY requirements.txt . +RUN pip install --no-cache-dir --prefix=/install -r requirements.txt + +FROM python:${python_version} +WORKDIR /app +COPY --from=builder /install /usr/local +COPY . . +ENV PYTHONUNBUFFERED=1 +EXPOSE 8080 +CMD ["sh", "-c", "python manage.py migrate && 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..a7770e5 --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,12 @@ +# ToDo App — Docker Instructions + +## Docker Hub Repository + +Image is available at: https://hub.docker.com/r/tanyasavenko/todoapp + +## Building the image + +1. Clone the repository: + ```bash + git clone [https://github.com/tanyasavenko/devops_todolist.git](https://github.com/tanyasavenko/devops_todolist.git) + cd devops_todolist \ No newline at end of file From 34b4e6dad3e0fd248e26275659398c73673432cc Mon Sep 17 00:00:00 2001 From: Tetiana Savenko Date: Mon, 25 May 2026 18:16:07 +0300 Subject: [PATCH 2/2] 'Solution1' --- Dockerfile | 3 ++- INSTRUCTION.md | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 02ebc22..c870d0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,6 @@ WORKDIR /app COPY --from=builder /install /usr/local COPY . . ENV PYTHONUNBUFFERED=1 +RUN python manage.py migrate EXPOSE 8080 -CMD ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8080"] \ No newline at end of file +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 a7770e5..140f875 100644 --- a/INSTRUCTION.md +++ b/INSTRUCTION.md @@ -7,6 +7,26 @@ Image is available at: https://hub.docker.com/r/tanyasavenko/todoapp ## Building the image 1. Clone the repository: - ```bash - git clone [https://github.com/tanyasavenko/devops_todolist.git](https://github.com/tanyasavenko/devops_todolist.git) - cd devops_todolist \ No newline at end of file +```bash + git clone https://github.com/tanyasavenko/devops_todolist.git + cd devops_todolist +``` + +2. Build the Docker image: +```bash + docker build -t todoapp:1.0.0 . +``` + +## Running the container + +```bash +docker run -p 8080:8080 todoapp:1.0.0 +``` + +## Accessing the application + +Open your browser and navigate to: + +``` +http://localhost:8080 +``` \ No newline at end of file