Add db preparation and webpack compilation when launching the container

This commit is contained in:
riggraz
2019-08-25 20:47:44 +02:00
parent 24339c0e08
commit c67774334c
4 changed files with 23 additions and 13 deletions

20
docker-entrypoint.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
# 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."
# 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 "$@"