Skip to content

Instantly share code, notes, and snippets.

@kevinmcalear
Forked from ljulliar/entrypoint.sh
Created March 27, 2020 11:10
Show Gist options
  • Save kevinmcalear/a3a2ac130ac62eecee46434e35403ca0 to your computer and use it in GitHub Desktop.
Save kevinmcalear/a3a2ac130ac62eecee46434e35403ca0 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