chore(docker): .dockerignore angepasst; lokale Build-Schritte in Rebuild-Skripten; Doku/README zu production vs production-prebuilt aktualisiert
This commit is contained in:
30
start.sh
30
start.sh
@@ -7,15 +7,33 @@ mkdir -p /app/.storage/treatments
|
||||
mkdir -p /app/.storage/availability
|
||||
mkdir -p /app/.storage/cancellation-tokens
|
||||
|
||||
# Change ownership to nextjs user
|
||||
chown -R nextjs:nodejs /app/.storage
|
||||
# Ensure permissive group-write permissions and correct ownership
|
||||
umask 002
|
||||
chown -R nextjs:nodejs /app/.storage 2>/dev/null || true
|
||||
chmod -R 775 /app/.storage 2>/dev/null || true
|
||||
|
||||
# Ensure runtime dependencies exist (for prebuilt images)
|
||||
if [ ! -d "/app/node_modules/hono" ]; then
|
||||
echo "[startup] Installing runtime dependencies (prebuilt safeguard)..."
|
||||
pnpm install --frozen-lockfile --prod --ignore-scripts=false || pnpm install --prod || true
|
||||
pnpm rebuild bcrypt || true
|
||||
echo "[startup] Checking runtime dependencies..."
|
||||
if [ ! -d "/app/node_modules/hono" ] || ! node -e "require('bcrypt')" 2>/dev/null; then
|
||||
if [ "$ALLOW_RUNTIME_INSTALL" = "true" ]; then
|
||||
echo "[startup] Installing/rebuilding runtime dependencies..."
|
||||
pnpm install --frozen-lockfile --prod --ignore-scripts=false || pnpm install --prod
|
||||
echo "[startup] Rebuilding bcrypt native bindings..."
|
||||
pnpm rebuild bcrypt --build-from-source
|
||||
echo "[startup] Verifying bcrypt installation..."
|
||||
node -e "require('bcrypt')" || { echo "[startup] ERROR: bcrypt verification failed!"; exit 1; }
|
||||
echo "[startup] bcrypt successfully installed and verified."
|
||||
else
|
||||
echo "[startup] ERROR: Runtime dependencies missing and ALLOW_RUNTIME_INSTALL not set!"
|
||||
echo "[startup] This should only happen in prebuilt scenarios. Check your setup."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Final verification before starting app
|
||||
echo "[startup] Final bcrypt verification before starting app..."
|
||||
node -e "require('bcrypt')" || { echo "[startup] FATAL: bcrypt not available!"; exit 1; }
|
||||
echo "[startup] All checks passed. Starting application..."
|
||||
|
||||
# Start the application as nextjs user
|
||||
exec su-exec nextjs node server-dist/index.js
|
||||
|
Reference in New Issue
Block a user