diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..01ed09f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +ARG PYTHON_VERSION=3.11 + +FROM python:${PYTHON_VERSION} AS builder + +WORKDIR /app + +COPY requirements.txt . + +RUN pip install --user -r requirements.txt + +COPY . . + +FROM python:${PYTHON_VERSION}-slim + +WORKDIR /app + +COPY --from=builder /root/.local /root/.local + +COPY --from=builder /app . + +ENV PATH=/root/.local/bin:$PATH +ENV PYTHONUNBUFFERED=1 + +RUN python manage.py migrate + +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..bab82e7 --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,29 @@ +ToDo App Docker Instructions + +1. Docker Hub Repository +The pre-built image is available at the following link: +https://hub.docker.com/r/trickykot3/todoapp + +2. Build Instructions +Build for local use: + +docker build -t todoapp . + +Build for pushing to Docker Hub: + +docker build -t trickykot3/todoapp:1.0.0 . + +3. Run Instructions +Run the local image: + +docker run -p 8080:8080 --name my_todo_app todoapp + +Run the image from Docker Hub: + +docker run -p 8080:8080 --name my_todo_app trickykot3/todoapp:1.0.0 + +(Note: The todoapp and trickykot3/todoapp:1.0.0 tags refer to the same build; the only difference is the naming convention for local testing vs. registry deployment.) + +4. Accessing the Application +Once the container is up and running, you can access the application via your web browser at: +http://localhost:8080 \ No newline at end of file