2019-08-25 20:47:44 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# Exit immediately if a command exits with a non-zero status.
|
|
|
|
|
set -e
|
|
|
|
|
|
2019-08-26 10:41:46 +02:00
|
|
|
if [ "$UPDATE" = 1 ]; then
|
|
|
|
|
# Create database, load schema, run migrations and seed data in an idempotent way.
|
|
|
|
|
echo "Preparing database..."
|
|
|
|
|
rake db:prepare
|
|
|
|
|
echo "Database prepared."
|
|
|
|
|
|
|
|
|
|
# Use webpack to build JS and CSS.
|
|
|
|
|
echo "Compiling JS and CSS with webpack..."
|
|
|
|
|
./bin/webpack
|
|
|
|
|
echo "Webpack compilation completed."
|
2019-09-22 15:52:53 +02:00
|
|
|
|
|
|
|
|
exit 0
|
2019-08-26 10:41:46 +02:00
|
|
|
fi
|
2019-08-25 20:47:44 +02:00
|
|
|
|
|
|
|
|
# Remove a potentially pre-existing server.pid for Rails.
|
|
|
|
|
rm -f /app/tmp/pids/server.pid
|
|
|
|
|
|
|
|
|
|
# Then exec the container's main process (what's set as CMD in the Dockerfile).
|
|
|
|
|
exec "$@"
|