<% if ruby_version.include? 'alpine' %>#!/usr/bin/env sh<% else %>#!/usr/bin/env bash<% end %> <% if DRConfig.linked_database? %> <% if databases.values.include?('mysql') || databases.values.include?('postgres') %> echo "Waiting for database server to start properly ..." && sleep 20 <% end %> <% end %> <% if application_env == 'production' || application_env == 'staging' %> RAILS_ENV=<%= application_env %> bundle exec rake assets:precompile <% elsif application_env == 'development' %> <% elsif application_env == 'test' %> echo "Rails application can not be running in 'test' environment" exit 1 <% else %> echo "Unknown environment '<%= application_env %>'" exit 1 <% end %> RAILS_ENV=<%= application_env %> bundle exec rake db:create RAILS_ENV=<%= application_env %> bundle exec rake db:migrate RAILS_ENV=<%= application_env %> bundle exec rake db:seed <% if DRNameSpace.namespace.test_env %> RAILS_ENV=<%= application_env %> bundle exec rake spec <% else %> RAILS_ENV=<%= application_env %> bundle exec rails server -b 0.0.0.0 -p <%= application_port %> <% end %>