From 3aa9f7791ae674edf62b6815807f8608611d143f Mon Sep 17 00:00:00 2001 From: Dmytro Hlazyrin Date: Sat, 18 Jul 2026 17:44:38 +0300 Subject: [PATCH] Create Dockerfile and push the image to the Docker Hub --- Dockerfile | 23 +++++++++++++++++++++++ INSTRUCTION.md | 24 ++++++++++++++++++++++++ 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..0d7223e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +ARG PYTHON_VERSION=3.12 + +FROM python:${PYTHON_VERSION} AS builder + +WORKDIR /app + +COPY . . + +FROM python:${PYTHON_VERSION}-slim AS runtime + +WORKDIR /app + +ENV PYTHONUNBUFFERED=1 + +COPY --from=builder /app . + +RUN pip install --upgrade pip && \ + pip install --no-cache-dir -r requirements.txt && \ + python manage.py migrate --noinput + +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..2b584a2 --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,24 @@ +# Docker documentation +Docker Hub repository: https://hub.docker.com/repository/docker/dmytrohlazyrin/todoapp/general + +## Build the image +```shell +docker build -t todoapp:1.0.0 . +``` + +## Run the container +```shell +docker run -d -p 8080:8080 --name todolistapp todoapp:1.0.0 +``` + +## Accessing the application via a browser +```text +http://localhost:8080/ +``` + +## Push the image to the Docker Hub + +```bash +docker tag todoapp:1.0.0 dmytrohlazyrin/todoapp:1.0.0 +docker push dmytrohlazyrin/todoapp:1.0.0 +```