Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ARG PYTHON_VERSION=3.8-slim
FROM python:${PYTHON_VERSION} AS builder
WORKDIR /app
COPY requirements.txt ./
RUN pip install --target=/packages -r requirements.txt
COPY . ./
ENV PYTHONPATH=/packages
Comment on lines +4 to +7
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 commands are in the wrong order. You must build the image before you can tag it. Move docker build -t todoapp:1.0.0 . to come before the docker tag command.

Comment on lines +4 to +7
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 command order is still incorrect. docker tag and docker push cannot execute before docker build because there's no image to tag/push yet. Move docker build -t todoapp:1.0.0 . to be the first command, then place docker tag and docker push after it.

RUN python manage.py migrate
Comment thread
AlTym marked this conversation as resolved.
# Run stage
ARG PYTHON_VERSION=3.8-slim
FROM python:${PYTHON_VERSION}
Comment thread
AlTym marked this conversation as resolved.
WORKDIR /app
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/packages
COPY --from=builder /packages /packages
COPY --from=builder /app /app
CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"]
10 changes: 10 additions & 0 deletions INSTRUCTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Link to Docker repo: https://hub.docker.com/repository/docker/alyonatym/todoapp/general

instructions for building and running:
docker tag todoapp:1.0.0 alyonatym/todoapp:1.0.0
docker push alyonatym/todoapp:1.0.0
docker build -t todoapp:1.0.0 .
Comment on lines +4 to +6
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 command sequence is incorrect. docker tag and docker push (lines 4-5) must come after docker build (line 6), not before. You cannot tag an image that doesn't exist yet. Reorder to: build → tag → push → run

docker run -p 8080:8080 todoapp

instructions on accessing the application via a browser:
go to http://localhost:8080
Loading