2024-05-07 20:53:03 +02:00
|
|
|
#!/bin/bash
|
2025-05-06 11:16:50 +02:00
|
|
|
set -euxo pipefail
|
2024-05-07 20:53:03 +02:00
|
|
|
|
2025-05-12 09:53:59 +02:00
|
|
|
DOCKER=${DOCKER:-0}
|
|
|
|
|
|
2024-05-07 20:53:03 +02:00
|
|
|
if [ -f config/frontend_assets.manifest.json ]; then
|
|
|
|
|
echo "Assets have already been precompiled. Reusing."
|
|
|
|
|
else
|
|
|
|
|
echo "Assets need to be compiled"
|
|
|
|
|
JOBS=8 npm install
|
|
|
|
|
|
2026-05-12 12:07:54 +02:00
|
|
|
SECRET_KEY_BASE="$(openssl rand -hex 64)" RAILS_ENV=production DATABASE_URL=nulldb://db \
|
2024-05-07 20:53:03 +02:00
|
|
|
bin/rails openproject:plugins:register_frontend assets:precompile
|
|
|
|
|
|
|
|
|
|
if [ "$DOCKER" = "1" ]; then
|
|
|
|
|
rm -rf /tmp/nulldb
|
|
|
|
|
# Remove sprockets cache
|
|
|
|
|
rm -rf "$APP_PATH/tmp/cache/assets"
|
|
|
|
|
# Remove node_modules and entire frontend
|
|
|
|
|
rm -rf "$APP_PATH/node_modules/" "$APP_PATH/frontend/node_modules/"
|
|
|
|
|
# Remove angular cache
|
|
|
|
|
rm -rf "$APP_PATH/frontend/.angular"
|
|
|
|
|
# Clean cache in root
|
|
|
|
|
rm -rf /root/.npm
|
|
|
|
|
rm -f "$APP_PATH/log/production.log"
|
|
|
|
|
fi
|
|
|
|
|
fi
|