2019-12-31 12:53:18 +00:00
|
|
|
#!/bin/sh
|
2019-12-22 17:23:18 +00:00
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# Remove a potentially pre-existing server.pid for Rails.
|
|
|
|
rm -rf /app/tmp/pids/server.pid
|
|
|
|
rm -rf /app/tmp/cache/*
|
|
|
|
|
|
|
|
echo "Waiting for postgres to become ready...."
|
|
|
|
|
2020-09-11 09:02:24 +00:00
|
|
|
# Let DATABASE_URL env take presedence over individual connection params.
|
2020-11-05 18:36:07 +00:00
|
|
|
# This is done to avoid printing the DATABASE_URL in the logs
|
2021-08-03 17:26:55 +00:00
|
|
|
$(docker/entrypoints/helpers/pg_database_url.rb)
|
2020-11-05 18:36:07 +00:00
|
|
|
PG_READY="pg_isready -h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USERNAME"
|
|
|
|
|
|
|
|
until $PG_READY
|
2019-12-22 17:23:18 +00:00
|
|
|
do
|
|
|
|
sleep 2;
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Database ready to accept connections."
|
|
|
|
|
2021-09-28 15:19:50 +00:00
|
|
|
#install missing gems for local dev as we are using base image compiled for production
|
2020-01-26 18:30:13 +00:00
|
|
|
bundle install
|
|
|
|
|
2019-12-22 17:23:18 +00:00
|
|
|
BUNDLE="bundle check"
|
|
|
|
|
2019-12-31 12:53:18 +00:00
|
|
|
until $BUNDLE
|
2019-12-22 17:23:18 +00:00
|
|
|
do
|
|
|
|
sleep 2;
|
|
|
|
done
|
|
|
|
|
|
|
|
# Execute the main process of the container
|
|
|
|
exec "$@"
|