From b024dd1a11e4445c2861f8ce59174d698cad2e87 Mon Sep 17 00:00:00 2001 From: pedro Date: Tue, 24 Sep 2024 09:50:57 -0300 Subject: [PATCH] docker: add optional DEMO env var that includes the default snapshot import --- .env.example | 1 + docker-compose.yml | 1 + docker/devicehub-django.entrypoint.sh | 3 +++ 3 files changed, 5 insertions(+) diff --git a/.env.example b/.env.example index 18f815d..cf39121 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ DOMAIN=localhost +DEMO=false diff --git a/docker-compose.yml b/docker-compose.yml index d0d6e44..ee59640 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: environment: - DEBUG=true - DOMAIN=${DOMAIN:-localhost} + - DEMO=${DEMO:-n} volumes: - .:/opt/devicehub-django ports: diff --git a/docker/devicehub-django.entrypoint.sh b/docker/devicehub-django.entrypoint.sh index 68e3760..a8c0351 100644 --- a/docker/devicehub-django.entrypoint.sh +++ b/docker/devicehub-django.entrypoint.sh @@ -24,6 +24,9 @@ deploy() { ./manage.py add_institution example-org # TODO: one error on add_user, and you don't add user anymore ./manage.py add_user example-org user@example.org 1234 + if [ "${DEMO:-}" ]; then + ./manage.py up_snapshots example/snapshots/ user@example.org + fi fi }