Files
greenlight/bin/start
Ahmad Farhat 734f7a757e GRN2-241: Switched Docker base image to Alpine (#853)
* Switched to alpine image

* Switch Docker base image to alpine

* Removed uneeded code

* Slimmed it down even further
2020-02-12 17:49:35 -05:00

23 lines
547 B
Bash
Executable File

#!/bin/bash
if [ "$RAILS_ENV" = "production" ] && [ "$DB_ADAPTER" = "postgresql" ]; then
while ! curl http://$DB_HOST:${DB_PORT:-5432}/ 2>&1 | grep '52'
do
echo "Waiting for postgres to start up ..."
sleep 1
done
fi
db_create="$(RAILS_ENV=$RAILS_ENV bundle exec rake db:create 2>&1)"
echo $db_create
if [[ $db_create == *"already exists"* ]]; then
echo ">>> Database migration"
bundle exec rake db:migrate
else
echo ">>> Database initialization"
bundle exec rake db:schema:load
fi
exec bundle exec puma -C config/puma.rb