diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6cb9e97 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +ARG PYTHON_VERSION=3.13-slim +FROM python:${PYTHON_VERSION} AS builder +WORKDIR /build + +RUN python -m venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" \ + PYTHONUNBUFFERED=1 + +COPY requirements.txt . +RUN pip install -r requirements.txt + + +FROM python:${PYTHON_VERSION} AS runtime +WORKDIR /app + +COPY --from=builder /opt/venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" \ + PYTHONUNBUFFERED=1 + +COPY . . + +RUN python manage.py migrate + +ENTRYPOINT ["python"] +CMD ["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..66e2daf --- /dev/null +++ b/INSTRUCTION.md @@ -0,0 +1,32 @@ +# How to run the app + +## 1. Install Docker + +Download and install Docker for your OS: https://docs.docker.com/get-docker/ + +## 2. Build the image + +``` +docker build -t todoapp:1.0.0 . +``` + +## 3. Tag and push to Docker Hub + +``` +docker tag todoapp:1.0.0 666phx/todoapp:1.0.0 +docker push 666phx/todoapp:1.0.0 +``` + +## 4. Run the container + +``` +docker run -d -p 8080:8080 666phx/todoapp:1.0.0 +``` + +## 5. Open in browser + +Go to: http://localhost:8080 + +--- + +Docker Hub image: https://hub.docker.com/r/666phx/todoapp/tags