#!/bin/sh if [ -z "$DB_PASS" ]; then echo "[ERROR] Mariadb database password must be set !" exit 1 fi if [ -z "$FORUM_URL" ]; then echo "[ERROR] Forum url must be set !" exit 1 fi # if no installation was performed before if [ ! -e '/flarum/www/app/config.php' ]; then cd /flarum/app/ # Flarum settings cat > config.yml < \$app->make('flarum.config')\]|['config' => \$app->isInstalled() ? \$app->make('flarum.config') : []]|g" vendor/flarum/core/src/Console/Server.php # Set permissions chown -R flarum:flarum /flarum/app # Install flarum (migrate database + assets) su-exec flarum:flarum php flarum install --file config.yml # Define flarum settings in database mysql -h"${DB_HOST}" -u"${DB_USER}" -p"${DB_PASS}" "${DB_NAME}" < config.sql # Removing installation files rm -f config.sql config.yml # Moving sources to the final web directory cd / && mv /flarum/app /flarum/www else echo "[INFO] Flarum already installed, launch app..." # Removing the source directory rm -rf /flarum/app fi # Set web directory permissions chown -R flarum:flarum /flarum/www # RUN ! supervisord -c /etc/supervisor/supervisord.conf