Skip to content

Instantly share code, notes, and snippets.

@ljulliar
Created May 20, 2019 07:13
Show Gist options
  • Save ljulliar/af99c7c7c7dc846697031cb0b1ba8a8e to your computer and use it in GitHub Desktop.
Save ljulliar/af99c7c7c7dc846697031cb0b1ba8a8e to your computer and use it in GitHub Desktop.
Entrypoint script (Photo Album on Google Cloud Run)
#!/usr/bin/env bash
cd /usr/src/app
# Create the Rails production DB on first run
RAILS_ENV=production bundle exec rake db:create
# Make sure we are using the most up to date
# database schema
RAILS_ENV=production bundle exec rake db:migrate
# Do some protective cleanup
> log/production.log
rm -f tmp/pids/server.pid
# Run the web service on container startup
# $PORT is provided as an environment variable by Cloud Run
bundle exec rails server -e production -b 0.0.0.0 -p $PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment