From c9875ed7abe25d083189f85a1e12c3f46a9d9038 Mon Sep 17 00:00:00 2001 From: VadymChan Date: Tue, 2 Jun 2026 13:08:30 +0300 Subject: [PATCH] complete the task --- Dockerfile | 18 ++++++++++++++++++ INSTRUCTION.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Dockerfile create mode 100644 INSTRUCTION.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b5395e1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +ARG PYTHON_VERSION=3.8 +FROM python:${PYTHON_VERSION} AS base +WORKDIR /app +COPY . . +ENV PATH="/venv/bin:$PATH" +RUN python -m venv /venv && \ + pip install -r requirements.txt && \ + python manage.py migrate + +FROM python:${PYTHON_VERSION}-slim +ENV PYTHONUNBUFFERED=1 +ENV PATH="/venv/bin:$PATH" +WORKDIR /app +COPY --from=base /venv /venv +COPY --from=base /app /app +EXPOSE 8080 +ENTRYPOINT ["python", "manage.py", "runserver"] +CMD ["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..6b2f4e4 --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,29 @@ +## Link to Docker Hub repository + +https://hub.docker.com/repository/docker/vadk1m/todoapp/general + +## How to build and run the app + +To build the image, run the following command: + +```bash +docker build -t todoapp:1.0.0 . +``` + +To run the built image, execute the following command: + +```bash +docker run -p 8080:8080 todoapp:1.0.0 +``` + +Alternatively, pull the image from the Docker Hub repository and run the container: + +```bash +docker pull vadk1m/todoapp:1.0.0 +docker run -p 8080:8080 vadk1m/todoapp:1.0.0 +``` + +## How to access the app + +- http://localhost:8080/ - landing page +- http://localhost:8080/api/ - API page