diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bb53e44 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +ARG PYTHON_VERSION=3.11 +FROM python:${PYTHON_VERSION} AS build + +WORKDIR /app + +COPY . . + +RUN python -m venv venv +ENV PATH="/app/venv/bin:$PATH" + +RUN pip install --upgrade pip && \ + pip install --no-cache-dir -r requirements.txt + + +FROM python:${PYTHON_VERSION}-slim AS run + +WORKDIR /app +ENV PYTHONUNBUFFERED=1 + +COPY --from=build /app /app + +ENV PATH="/app/venv/bin:$PATH" +RUN python manage.py migrate + +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..eba5cef --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,48 @@ +# ToDo App — Docker Instructions + +## Docker Hub Repository + +The image is available on Docker Hub: +https://hub.docker.com/r/olehkovalievskyi/todoapp + +## Prerequisites + +- Docker installed on your machine +- (Optional) Docker Hub account, if you want to pull the pre-built image + +## Build the image locally + +Clone the repository and navigate to its root directory, then run: + +```bash +docker build -t todoapp:1.0.0 . +``` + +## Run the container + +```bash +docker run -d -p 8080:8080 --name todoapp-container todoapp:1.0.0 +``` + +Alternatively, you can pull and run the pre-built image directly from Docker Hub: + +```bash +docker pull olehkovalievskyi/todoapp:1.0.0 +docker run -d -p 8080:8080 --name todoapp-container olehkovalievskyi/todoapp:1.0.0 +``` + +## Stopping the container + +```bash +docker stop todoapp-container +``` + +## Access the application + +Once the container is running, open your browser and navigate to: + +http://localhost:8080 + +## Notes + +- The application listens on `0.0.0.0:8080` inside the container. \ No newline at end of file