- Remove Node.js from production image (was violating Must NOT Have constraint) - Add 'RUN cp -r /app/public /app/public-build' in build stage after npm run build - Replace 'npm run build' in boot-container.sh with 'cp -r /app/public-build/*' - Add chown www-data for SQLite DB file in init-app.sh - Remove git from production stage package list (not in plan spec) - Update ENTRYPOINT comment to reflect new asset sync approach
54 lines
1.6 KiB
Bash
Executable file
54 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
cd /app
|
|
|
|
echo "[boot] Starting pp-planer container boot..."
|
|
|
|
# Ensure all required directories exist (volumes may be freshly mounted)
|
|
mkdir -p \
|
|
storage/logs \
|
|
storage/framework/views \
|
|
storage/framework/cache/data \
|
|
storage/framework/sessions \
|
|
storage/app/public \
|
|
database \
|
|
public
|
|
|
|
# Run first-time initialization (idempotent — safe to call every boot)
|
|
/app/build/init-app.sh
|
|
|
|
# Fix permissions: www-data must own all writable directories.
|
|
# The || true prevents exit on macOS Docker Desktop (bind-mount ownership restrictions).
|
|
# On a Linux host running as root, chown will succeed silently.
|
|
chown -R www-data:www-data storage bootstrap/cache database 2>/dev/null || true
|
|
chmod -R 775 storage bootstrap/cache database 2>/dev/null || true
|
|
|
|
rm -f /app/public/hot
|
|
|
|
echo "[boot] Syncing pre-built Vite assets to bind-mounted public/ ..."
|
|
cp -r /app/public-build/* /app/public/ 2>/dev/null || true
|
|
|
|
# Create RELATIVE storage symlink (public/storage → ../storage/app/public).
|
|
# Must be relative: Caddy serves the bind-mounted ./public from the host, where
|
|
# the container's /app/* paths do not exist — an absolute symlink would dangle
|
|
# from Caddy's view and return 404 for every /storage/* request.
|
|
echo "[boot] Creating storage symlink..."
|
|
ln -sfn ../storage/app/public public/storage
|
|
|
|
# Run database migrations
|
|
echo "[boot] Running migrations..."
|
|
php artisan migrate --force
|
|
|
|
# Warm up Laravel caches
|
|
echo "[boot] Warming caches..."
|
|
php artisan config:cache
|
|
php artisan route:cache
|
|
php artisan view:cache
|
|
php artisan event:cache
|
|
|
|
echo "[boot] Boot complete. Starting supervisord..."
|
|
|
|
# Hand off to CMD (supervisord)
|
|
exec "$@"
|