Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions INSTRUCTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ToDo App Dockerization

Link to Docker Hub repository: [https://hub.docker.com/r/petrosfas/todoapp](https://hub.docker.com/r/petrosfas/todoapp)

## How to build the image locally
To build the Docker image, run the following command in the directory containing the Dockerfile:
`docker build -t todoapp:1.0.0 .`

## How to tag and push the image to Docker Hub
First, tag the local image with your Docker Hub username:
`docker tag todoapp:1.0.0 petrosfas/todoapp:1.0.0`

Then, push the image to the repository:
`docker push petrosfas/todoapp:1.0.0`

## How to run the container
To start the container, use the following command:
`docker run -p 8080:8080 petrosfas/todoapp:1.0.0`

## How to access the application
Once the container is running, open your web browser and navigate to:
`http://localhost:8080`
31 changes: 31 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ARG PYTHON_VERSION=3.12

FROM python:${PYTHON_VERSION} AS builder

WORKDIR /app

RUN python -m venv /opt/venv

ENV PATH="/opt/venv/bin:$PATH"

COPY requirements.txt .
RUN pip install -r requirements.txt


FROM python:${PYTHON_VERSION} as runstage

ENV PYTHONUNBUFFERED=1

WORKDIR /app

COPY --from=builder /opt/venv /opt/venv

ENV PATH="/opt/venv/bin:$PATH"

COPY . .

RUN python manage.py migrate

EXPOSE 8080

ENTRYPOINT ["python", "manage.py", "runserver", "0.0.0.0:8080"]
Loading