docker: better devicehub entrypoint

This commit is contained in:
pedro 2025-02-11 16:15:49 +01:00
parent 976ce43e6e
commit 35a753d244
2 changed files with 9 additions and 3 deletions

View file

@ -1,2 +1,3 @@
db
.git
already_configured

View file

@ -200,9 +200,11 @@ check_app_is_there() {
}
deploy() {
# TODO this is weird, find better workaround
git config --global --add safe.directory "${program_dir}"
export COMMIT=$(git log --format="%H %ad" --date=iso -n 1)
if [ -d /opt/devicehub-django/.git ]; then
# TODO this is weird, find better workaround
git config --global --add safe.directory "${program_dir}"
export COMMIT=$(git log --format="%H %ad" --date=iso -n 1)
fi
if [ "${DEBUG:-}" = 'true' ]; then
./manage.py print_settings
@ -218,6 +220,9 @@ deploy() {
# move the migrate thing in docker entrypoint
# inspired by https://medium.com/analytics-vidhya/django-with-docker-and-docker-compose-python-part-2-8415976470cc
echo "INFO detected NEW deployment"
if [ ! -d "${program_dir}/db/" ]; then
mkdir -p "${program_dir}/db/"
fi
./manage.py migrate
config_phase
fi