2023-09-30 11:39:51 -07:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
2023-09-30 21:08:14 -07:00
|
|
|
echo "entrypoint"
|
2023-09-30 21:01:33 -07:00
|
|
|
echo "${*}"
|
|
|
|
|
|
2023-09-30 22:13:55 -07:00
|
|
|
# NOTE: Enable this as you need to get migrations working in your deployed
|
|
|
|
|
# (i.e. Production) environments. Match the condition check to what you have in
|
|
|
|
|
# the Dockerfile CMD. I use puma in the production.Dockerfile as that's the
|
|
|
|
|
# recommended option by the Puma team (https://github.com/puma/puma#rails), but
|
|
|
|
|
# the default Rails Dockerfile uses `./bin/rails server`
|
|
|
|
|
#
|
2023-09-30 11:39:51 -07:00
|
|
|
# If running the rails server then create or migrate existing database
|
2023-09-30 19:16:44 -07:00
|
|
|
# if [ "${*}" == "./bin/rails server" ]; then
|
2023-09-30 11:39:51 -07:00
|
|
|
# ./bin/rails db:prepare
|
2023-09-30 19:16:44 -07:00
|
|
|
# fi
|
2023-09-30 11:39:51 -07:00
|
|
|
|
2023-09-30 21:55:05 -07:00
|
|
|
# Run database migrations when deploying to Render. It is not great, maybe there's a better way?
|
|
|
|
|
# https://community.render.com/t/release-command-for-db-migrations/247/6
|
|
|
|
|
if [ -z "$RENDER" ]; then echo "var is unset"; else bin/rails db:migrate; fi
|
|
|
|
|
|
2023-09-30 11:39:51 -07:00
|
|
|
exec "${@}"
|