djangoBase/docker-develop.yaml

34 lines
897 B
YAML

version: "3.7"
services:
db:
image: postgres
volumes:
- ./data/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=djangoApp
- POSTGRES_USER=django
- POSTGRES_PASSWORD=postgres_changeme
web:
build:
context: ./
target: pythonDeps #Don't include our actual source code in the image
command: |
sh -c "
while ! nc -z db 5432; do sleep 0.2; done; #Wait for postgres to start
python3 djangobase/manage.py migrate
python3 djangobase/manage.py runserver 0.0.0.0:8000"
environment:
DATABASE_URL: postgres://django:postgres_changeme@db:5432/djangoApp
SECRET_KEY: Changeme #Very important that you change this.
#Generate a new one with: python -c "import secrets; print(secrets.token_urlsafe())"
volumes:
- ./:/code
ports:
- "8000:8000"
depends_on:
- db