Skip to content

Instantly share code, notes, and snippets.

@szromek
Created October 26, 2017 09:50
Show Gist options
  • Save szromek/8ff81968e70806dfb1f4864af5bf914f to your computer and use it in GitHub Desktop.
Save szromek/8ff81968e70806dfb1f4864af5bf914f to your computer and use it in GitHub Desktop.
Entrypoint for Ruby on Rails app on Docker
#! /bin/bash
bundle exec rake db:migrate
if [[ $? != 0 ]]; then
echo
echo "== Failed to migrate. Running setup first."
echo
bundle exec rake db:setup
fi
# Execute the given or default command:
exec "$@"
@in8finity
Copy link

if for some reason bundle exec rake db:migrate - will fail with non zero return code
it will destroy your existing db

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment