add docker compose setup for development

This commit is contained in:
Andreas Gohr 2025-08-20 12:44:32 +02:00 committed by Tobias Herre
parent 4c458c16d7
commit 5696072604
2 changed files with 54 additions and 1 deletions

View File

@ -2,10 +2,11 @@
purpose: gather data from intern(WMDE) and extern(volunteers) forms to create a database ('förderdatenbank') and send emails with links for a questionary. purpose: gather data from intern(WMDE) and extern(volunteers) forms to create a database ('förderdatenbank') and send emails with links for a questionary.
## installation and development setup ## manual development setup
cp .env.develop.example .env cp .env.develop.example .env
By default a SQLite database is used for development.
To use a MariaDB change `DATABASE_ENGINE` in .env to `mysql` and amend `DATABASE_*` variables according to your setup. To use a MariaDB change `DATABASE_ENGINE` in .env to `mysql` and amend `DATABASE_*` variables according to your setup.
For further information see the production setup below. For further information see the production setup below.
@ -27,6 +28,25 @@ access via
http://localhost:8000/intern/ (login required) http://localhost:8000/intern/ (login required)
http://localhost:8000/admin/ (login reqiured) http://localhost:8000/admin/ (login reqiured)
## docker compose development setup
The project comes with a `docker-compose.yml` file to run the project in a containerized environment.
cp .env.develop.example .env
docker compose up
The setup will use a containerized MariaDB database.
Create your superuser account with
docker compose exec django python3 manage.py createsuperuser
You can access the application via
http://localhost:8000/
http://localhost:8000/intern/ (login required)
http://localhost:8000/admin/ (login required)
## additional admin functionality ## additional admin functionality
The admin page is the standard admin page delivered by django but with two additional functionalities: The admin page is the standard admin page delivered by django but with two additional functionalities:

33
docker-compose.yaml Normal file
View File

@ -0,0 +1,33 @@
services:
django:
image: python:3-alpine
working_dir: /app
volumes:
- .:/app
environment:
PYTHONUNBUFFERED: 1
DATABASE_ENGINE: mysql
DATABASE_HOST: mariadb
DATABASE_USER: fdb
DATABASE_PASSWORD: fdb
ports:
- 8000:8000
command:
- sh
- -c
- |
apk update
apk add gcc
apk add mariadb-dev
apk add musl-dev
pip install -Ur requirements.txt
python manage.py migrate
python manage.py runserver 0.0.0.0:8000
mariadb:
image: mariadb
environment:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: yes
MARIADB_DATABASE: fdb
MARIADB_USER: fdb
MARIADB_PASSWORD: fdb