#!/bin/bash -e echo "entrypoint docker: ${@} ${ASSETS_PATH} :: ${@: 1:1} / ${@: 2:1}" # If running the rails server then create or migrate existing database if [ "${@: 1:1}" == "./bin/rails" ] && [ "${@: 2:1}" == "server" ]; then if [ -f ${INSTALL_DIR}/pids/server.pid ]; then rm ${INSTALL_DIR}/pids/server.pid fi echo "Prepare db..." ./bin/rails db:prepare echo "Copy assets to <$ASSETS_PATH>?" if [[ -n "$ASSETS_PATH" ]]; then echo "Copy assets to $ASSETS_PATH" find "$INSTALL_DIR/public" -mindepth 1 -exec echo "copy " {} \; find "$INSTALL_DIR/public" -mindepth 1 -exec cp -a {} "$ASSETS_PATH" \; fi fi exec "${@}"