Files
SealShare/docker/entrypoint.sh
T
surtic86andClaude Opus 5 4530298398
docker / test (8.5) (push) Successful in 3m10s
linter / quality (push) Successful in 1m5s
tests / ci (8.5) (push) Successful in 3m9s
docker / build-and-push (push) Successful in 21m5s
docker / release (push) Skipped
Cut over-engineering found by a repo-wide audit
- Config: auth, services, logging, queue and database only repeated the
  framework's own files and are gone; the others keep only the keys that
  differ (app version, cache serializable_classes, session cookie name,
  Markdown mail theme, the shares disk, three Octane values, Livewire's
  pagination theme and payload guards).
- Email verification is removed: User never implemented MustVerifyEmail,
  so it was never enforced, and SealShare has a single admin and no
  registration. CreateNewUser goes with it.
- FileEncryptionService::encryptFile() and generateSalt() were only used
  by tests; tests build files with encryptTestFile() in tests/Pest.php.
- The expiration options are defined once, as Share::EXPIRATIONS. "30 Days"
  now lasts 30 days instead of a calendar month, and Admin settings only
  save a default expiration that is one of the options.
- One-caller helpers are inlined, the uploader reads chunk responses with
  XHR's responseType, and starter-kit leftovers are removed.
- Docker: PHP reads the PHP_* limits from the environment itself
  (${VAR:-default} in uploads.ini); both entrypoints stop writing the ini.
  docker-compose.yml shares the app and scheduler variables through one
  anchor. The dev image installs gd for the screenshot publisher and fake
  test images.
- Development runs in Docker only: the composer dev script, concurrently,
  laravel/pail, laravel/sail, autoprefixer and the shell-quote override
  are gone.
- phpunit.xml forces the test environment with <server> entries, so tests
  run in the dev container no longer use its real database.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 23:14:33 +02:00

50 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
set -e
cd /app
# Auto-generate APP_KEY if not provided
if [ -z "$APP_KEY" ]; then
echo "[entrypoint] No APP_KEY set, generating one..."
APP_KEY=$(php artisan key:generate --show)
export APP_KEY
echo "[entrypoint] Generated APP_KEY: $APP_KEY"
echo "[entrypoint] WARNING: Set this APP_KEY in your docker-compose.yml to persist across restarts!"
fi
# A docker-compose.yml from before 2.1.1 mounts the SQLite volume over all of /app/database, so the
# migrations folder is the one the volume was created with: add this image's newer migrations to it.
for migration in docker/migrations/*.php; do
if [ ! -e "database/migrations/${migration##*/}" ]; then
echo "[entrypoint] Adding migration ${migration##*/} to the database volume..."
mkdir -p database/migrations
cp "$migration" database/migrations/
fi
done
echo "[entrypoint] Running database migrations..."
php artisan migrate --force
echo "[entrypoint] Creating storage link..."
php artisan storage:link --force
echo "[entrypoint] Caching configuration..."
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Uploads are encrypted in the browser, which browsers only allow over HTTPS: either this container
# fetches a certificate for SERVER_NAME itself, or a reverse proxy in front terminates TLS.
if [ "${AUTO_HTTPS:-false}" = "true" ]; then
if [ -z "$SERVER_NAME" ]; then
echo "[entrypoint] AUTO_HTTPS=true needs SERVER_NAME, the domain to fetch a certificate for." >&2
exit 1
fi
echo "[entrypoint] Starting Octane (FrankenPHP) with automatic HTTPS for $SERVER_NAME..."
exec php artisan octane:frankenphp --host="$SERVER_NAME" --port=443 --https --http-redirect
fi
echo "[entrypoint] Starting Octane (FrankenPHP) on HTTP..."
exec php artisan octane:frankenphp --host=0.0.0.0 --port=80