Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example Fix + Docker #747

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ docs: clean
example:
cd example && python manage.py runserver

.PHONY: example
example-docker-build:
cd example && docker compose build
docker compose run example python manage.py migrate
docker compose up

.PHONY: example
example-docker:
cd example && docker compose up

.PHONY: porcelain
porcelain:
ifeq ($(shell git status --porcelain),)
Expand Down
3 changes: 3 additions & 0 deletions example/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Dockerfile
README.md
docker-compose.yml
12 changes: 12 additions & 0 deletions example/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.11.5-slim-bullseye

ENV PIP_DISABLE_PIP_VERSION_CHECK 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

WORKDIR /example

COPY ./requirements.txt .
RUN pip install -r requirements.txt

COPY . .
9 changes: 9 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,14 @@ pip install -r requirements.txt
python manage.py migrate
python manage.py runserver
```
or using docker:
```bash
git clone https://github.com/zostera/django-bootstrap4.git

cd django-bootstrap4/example
docker compose build
docker compose run example python manage.py migrate
docker compose up
```

Server should be live at http://127.0.0.1:8000/ now.
9 changes: 9 additions & 0 deletions example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
example:
container_name: example
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .//:/example
ports:
- 8000:8000
2 changes: 2 additions & 0 deletions example/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
django
django-bootstrap4