From bca3c9f059382c1e240a37b638406ddd7b17978b Mon Sep 17 00:00:00 2001 From: Ihor Hurianov Date: Fri, 15 May 2026 14:36:05 +0300 Subject: [PATCH] Solution --- Dockerfile | 28 ++++++++++++++++++++++++++++ INSTRUCTION.md | 30 ++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 Dockerfile create mode 100644 INSTRUCTION.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d923ab9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +ARG PYTHON_VERSION=3.11 + +FROM python:${PYTHON_VERSION} AS base + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --upgrade pip && \ + pip install --prefix=/install -r requirements.txt + +FROM python:${PYTHON_VERSION}-slim AS runner + +ENV PYTHONUNBUFFERED=1 + +WORKDIR /app + +# Copy installed packages from build stage +COPY --from=base /install /usr/local + +# Copy application source code +COPY . . + +# Execute database migration +RUN python manage.py migrate + +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..1abae8d --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,30 @@ +## Docker Hub Repository + +Image is available at: [https://hub.docker.com/r/gurianov88/todoapp] + +## Building the Docker Image + +Clone the repository and navigate into it: + +```bash +git clone https://github.com/IgorSteal/devops_todolist.git +cd devops_todolist +``` + +Build the image and tag it as `todoapp:1.0.0`: + +```bash +docker build -t todoapp:1.0.0 . +``` + +## Running the Container + +```bash +docker run -d -p 8080:8080 --name todoapp todoapp:1.0.0 +``` + + +## Accessing the Application + +- **Landing page:** [http://localhost:8080](http://localhost:8080) +- **API browser:** [http://localhost:8080/api/](http://localhost:8080/api/) \ No newline at end of file