Packaging fixes
This commit is contained in:
parent
fa6103d007
commit
959b06c425
19 changed files with 389 additions and 68 deletions
|
|
@ -1,5 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
django-admin makemigrations --noinput --check && django-admin migrate --noinput
|
||||
django-admin clear_cache
|
||||
django-admin collectstatic -c --no-input
|
||||
echo "Running makemigrations --check to make sure migrations are up to date..."
|
||||
django-admin makemigrations --noinput --check 2>&1
|
||||
|
||||
echo "Running migrate to apply migrations..."
|
||||
django-admin migrate --noinput 2>&1
|
||||
|
||||
echo "Clearing django cache..."
|
||||
django-admin clear_cache 2>&1
|
||||
|
||||
echo "Running collectstatic..."
|
||||
django-admin collectstatic -c --no-input 2>&1
|
||||
|
||||
echo "Deployed successfully!"
|
||||
|
|
@ -1,13 +1,23 @@
|
|||
#!/bin/bash
|
||||
set -exc
|
||||
set -ex
|
||||
|
||||
# Load environment variables from .env file if it exists in /code/
|
||||
if [ -f /.env ]; then
|
||||
echo "Loading environment variables from .env"
|
||||
# Set allexport option to export all variables defined by sourcing the .env file.
|
||||
set -a
|
||||
source /.env
|
||||
# Unset allexport option.
|
||||
set +a
|
||||
else
|
||||
echo "Warning: Volume mount for /.env file not found. Make sure you are using env_file in docker-compose.yml or mounting it in the container."
|
||||
fi
|
||||
|
||||
# check if the startup command has been provided
|
||||
if [ "$1" == "" ]; then
|
||||
echo "Startup command not set. Exiting"
|
||||
exit;
|
||||
fi
|
||||
|
||||
# check if the $DJANGO_SETTINGS_MODULE environment variable has been set
|
||||
if [ "$DJANGO_SETTINGS_MODULE" == "" ]; then
|
||||
echo "Environment variable 'DJANGO_SETTINGS_MODULE' not set. Exiting."
|
||||
exit;
|
||||
|
|
@ -15,6 +25,7 @@ else
|
|||
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
|
||||
fi
|
||||
|
||||
echo "Running deploy.sh..."
|
||||
/deploy.sh
|
||||
|
||||
echo "Enviroment is correct and deploy.sh has been run - executing command: '$@'"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@ echo "Waiting for the database to be ready..."
|
|||
sleep 10
|
||||
|
||||
echo "Loading seed data..."
|
||||
docker compose exec -it web env DJANGO_SETTINGS_MODULE=django_project.settings django-admin loaddata /code/seed/0*
|
||||
docker compose exec -it web bash -c "django-admin loaddata /seed/0*"
|
||||
|
||||
echo "Done & Started!"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue