48 lines
979 B
Bash
Executable File
48 lines
979 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
file_env() {
|
|
local var="$1"
|
|
local fileVar="${var}_FILE"
|
|
local def="${2:-}"
|
|
|
|
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
|
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
|
exit 1
|
|
fi
|
|
|
|
local val="$def"
|
|
if [ "${!var:-}" ]; then
|
|
val="${!var}"
|
|
elif [ "${!fileVar:-}" ]; then
|
|
val="$(< "${!fileVar}")"
|
|
fi
|
|
|
|
export "$var"="$val"
|
|
unset "$fileVar"
|
|
}
|
|
|
|
# for sidekiq service bundle exec env var threading
|
|
file_env "OTP_SECRET"
|
|
file_env "SECRET_KEY_BASE"
|
|
file_env "DB_PASS"
|
|
file_env "SMTP_PASSWORD"
|
|
file_env "VAPID_PRIVATE_KEY"
|
|
|
|
export RAILS_ENV=production
|
|
|
|
{{ if eq (env "OIDC_ENABLED") "true" }}
|
|
file_env "OIDC_CLIENT_SECRET"
|
|
{{ end }}
|
|
|
|
|
|
bundle exec rake db:setup || /bin/true
|
|
# bundle exec rake webpacker:verify_install || bundle exec rake webpacker:install
|
|
# bundle exec rake webpacker:yarn_install
|
|
# bundle exec rake assets:clobber
|
|
bundle exec rake assets:precompile || /bin/true
|
|
|
|
|
|
/usr/bin/tini -s -- "$@"
|