docbrown/scripts/entrypoint.sh
Joe Doss f34dbf4693
Better production container precompiling and bootstrapping (#10280)
* Create entrypoint-dev.sh to be used with devel workflows with docker/podman compose
and adjust the compose files to use it.

* Adjust the entrypoint script so we have better control over when we run
rake assets:precompile and rake app_initializer:setup.

* Copy vendor/cache so we can bundle install from cached gems instead of
fetching them from the Internet.

* Run rake assets:precompile in the container build.

* Add in clobber and clean tasks to entrypoint.
2020-09-16 16:59:19 -05:00

41 lines
745 B
Bash
Executable file

#!/usr/bin/env bash
set -e
if [ -f tmp/pids/server.pid ]; then
rm -f tmp/pids/server.pid
fi
export RELEASE_FOOTPRINT=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
export FOREM_BUILD_DATE=$(cat FOREM_BUILD_DATE)
export FOREM_BUILD_SHA=$(cat FOREM_BUILD_SHA)
case "$@" in
precompile)
echo "Running rake assets:precompile..."
bundle exec rake assets:precompile
;;
clean)
echo "Running rake assets:clean..."
bundle exec rake assets:clean
;;
clobber)
echo "Running rake assets:clobber..."
bundle exec rake assets:clobber
;;
bootstrap)
echo "Running rake app_initializer:setup..."
bundle exec rake app_initializer:setup
;;
*)
echo "Running command:"
echo "$@"
exec "$@"
;;
esac