docbrown/scripts/entrypoint.sh
Joe Doss 44569605d2
Fix container composes w/r/t multistage container builds (#11531)
* Use premade development image.

* Use prebuilt container for podman-compose too!

* Fix bundle bundle_finished path.

* Fix docker-compose to work with the Multistage Containerfile

Add root user for Forem containers, fix bundle_finished path and make
webpacker wait for the bundle to finish.

Switch Redis to redis:6.0.9-alpine

* Remove build steps and fix bundle path.

* Merge dev entrypoint into the main one.

* Use merged entrypoint.sh, remove old entrypoint directives, and fix a dockerize bug.

* Make sure unset BUNDLE_WITHOUT and remove without in bundle config.

* Unset BUNDLE_WITHOUT="development:test" as a global ENV.

Also ensure that we remove the without directives for development and testing.
This will make sure that the right gems are installed for each environment.

Removed some unneeded COPYs and remove a commented out RUN.

* Fix ENTRYPOINT on development and testing containers.

* Fix entrypoint and command on rails container.

* Ignore bundle_finished file.

* Fix REDIS_ env vars and adjust podman-compose file.

* Change bundle_finished path and update Yarn docker-compose command.
2020-11-23 15:15:21 -06:00

51 lines
934 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')
if [[ "${RAILS_ENV}" = "development" || "${RAILS_ENV}" = "test" ]]; then
export FOREM_BUILD_DATE=RELEASE_FOOTPRINT
export FOREM_BUILD_SHA=$(git rev-parse --short HEAD)
else
export FOREM_BUILD_DATE=$(cat FOREM_BUILD_DATE)
export FOREM_BUILD_SHA=$(cat FOREM_BUILD_SHA)
fi
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