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
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARG PYTHON_VERSION=3.8-slim

FROM python:${PYTHON_VERSION} AS Builder

ENV PYTHONUNBUFFERED=1

WORKDIR /app

RUN python -m venv /app/.venv
ENV PATH=/app/.venv/bin:${PATH}

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

FROM python:${PYTHON_VERSION} AS Runner

WORKDIR /app

ENV PATH=/app/.venv/bin:${PATH}

COPY --from=Builder /app/.venv /app/.venv
COPY . .

RUN python manage.py migrate
EXPOSE 8080

CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"]
14 changes: 14 additions & 0 deletions INSTRUCTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Image repository link:
https://hub.docker.com/repository/docker/difuz1x/todoapp/general

to run the app:
docker pull difuz1x/todoapp:1.0.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical issue: ENV PYTHONUNBUFFERED=1 is set in the Builder stage, but the application runs in the Runner stage. Each FROM instruction creates a new stage with its own environment. This variable needs to be set in the Runner stage (after line 15) for the unbuffered Python output to work during runtime.


and then

docker run -d -p 8080:8080 --name todoapp difuz1x/todoapp:1.0.0

after application succesfully started

go to browser with URL:
http://localhost:8080
Loading