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
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# =========================
# Build stage
# =========================
ARG PYTHON_VERSION=3.11

FROM python:${PYTHON_VERSION}-slim AS builder

WORKDIR /app

ENV PYTHONUNBUFFERED=1

COPY requirements.txt .

RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt

COPY . .

RUN python manage.py migrate

# =========================
# Run stage
# =========================
FROM python:${PYTHON_VERSION}-slim

WORKDIR /app

ENV PYTHONUNBUFFERED=1

# Copy installed packages
COPY --from=builder /usr/local /usr/local

# Copy app
COPY --from=builder /app /app

EXPOSE 8080

CMD ["python", "manage.py", "runserver", "0.0.0.0:8080"]
29 changes: 29 additions & 0 deletions INSTRUCTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# ToDo App Docker Instructions

## Docker Hub Repository

https://hub.docker.com/r/grom201/todoapp

---

## Build image

```bash
docker build -t todoapp:1.0.0 .
```

---

## Run container

```bash
docker run -p 8080:8080 grom201/todoapp:1.0.0
Comment on lines +1 to +20
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 INSTRUCTION.md is missing the docker push command. After building the image locally with docker build -t todoapp:1.0.0 ., users need to push it to Docker Hub for the repository link to work. Add: docker push grom201/todoapp:1.0.0

```

---

## Access application

Open browser:

http://localhost:8080
2 changes: 1 addition & 1 deletion todolist/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['*']

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

Expand Down
Loading