Skip to content

Instantly share code, notes, and snippets.

@oraposa
Created December 28, 2017 21:35
Show Gist options
  • Save oraposa/bb8d0b41b851e515e5f5d896c8026572 to your computer and use it in GitHub Desktop.
Save oraposa/bb8d0b41b851e515e5f5d896c8026572 to your computer and use it in GitHub Desktop.
#entrypoint.sh
#!/bin/bash
cat docker_bashrc >> /root/.bashrc
# We want to see if they are trying to run a bash shell,
# if so skip the db migrate
echo "Options passed: $@"
if test "$1" != "bash"
then
# Do a database migration...
echo "Starting db migration"
bundle install # make sure we have everything we need
echo "Running rake db:migrate"
bin/rails db:migrate
if test $? -eq 0 ; then
echo "DB migration ended Succesfully"
else
echo "DB migration ended with errors"
fi
fi
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment