Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ARG PYTHON_VERSION=3.14.2-slim
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This Python version 3.14.2-slim does not seem to exist on Docker Hub. Please use a valid and available Python 3 tag, for example, 3.12-slim.

FROM python:${PYTHON_VERSION} AS build
WORKDIR /devops_todolist
ENV PYTHONUNBUFFERED=1
COPY requirements.txt /devops_todolist/
RUN pip install --no-cache-dir -r requirements.txt
COPY . /devops_todolist/
RUN python -c "import sysconfig; print(sysconfig.get_paths()['purelib'])"



RUN python manage.py migrate
FROM python:${PYTHON_VERSION} AS run
WORKDIR /devops_todolist
ENV PYTHONUNBUFFERED=1
COPY --from=build /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Python version in this path is hardcoded to 3.14. This makes the Dockerfile brittle and defeats the purpose of using the PYTHON_VERSION argument. The path should be constructed dynamically based on the value of PYTHON_VERSION to ensure the build works correctly if the version is changed.

COPY --from=build /devops_todolist /devops_todolist
EXPOSE 8080
CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"]
4 changes: 4 additions & 0 deletions INSTRUCTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Repo: https://hub.docker.com/repository/docker/midandnight/todoapp/general
Build: docker build -t midandnight/todoapp:1.0.0 .
Run: docker run -p 8080:8080 midandnight/todoapp:1.0.0
Open: http://localhost:8080
Loading