pkmntrade.club/scripts/entrypoint.sh
2025-05-09 08:43:43 -07:00

32 lines
No EOL
864 B
Bash
Executable file

#!/bin/bash
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
if [ "$1" == "" ]; then
echo "Startup command not set. Exiting"
exit;
fi
if [ "$DJANGO_SETTINGS_MODULE" == "" ]; then
echo "Environment variable 'DJANGO_SETTINGS_MODULE' not set. Exiting."
exit;
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: '$@'"
exec "$@" && exit 0