Created
December 19, 2016 10:35
-
-
Save bonyiii/5801ede522003ab446253c2d37b10bd7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
case "$1" in | |
rails|rake|passenger) | |
# ensure the right database adapter is active in the Gemfile.lock | |
if [ -z "$NO_BUNDLE" ]; then | |
# bundle install --without development test | |
bundle install | |
chown dev:dev $GEM_HOME -R | |
fi | |
if [ ! -s config/secrets.yml ]; then | |
if [ "$MYAPP_SECRET_KEY_BASE" ]; then | |
cat > 'config/secrets.yml' <<-YML | |
$RAILS_ENV: | |
secret_key_base: "$MYAPP_SECRET_KEY_BASE" | |
YML | |
elif [ ! -f /usr/src/redmine/config/initializers/secret_token.rb ]; then | |
rake generate_secret_token | |
fi | |
fi | |
if [ "$1" != 'rake' -a -z "$MYAPP_NO_DB_MIGRATE" ]; then | |
gosu dev rake db:migrate | |
fi | |
# remove PID file to enable restarting the container | |
rm -f /var/www/myapp-api/tmp/pids/server.pid | |
if [ "$1" = 'passenger' ]; then | |
# Don't fear the reaper. | |
set -- tini -- "$@" | |
fi | |
set -- gosu dev "$@" | |
;; | |
esac | |
exec "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment