#!/bin/sh # Idempotent start: prepare writable dirs, migrate the database, then run the built-in server. set -eu cd /app mkdir -p tmp/cache tmp/sessions tmp/mails tmp/dompdf logs if [ -z "${SECURITY_SALT:-}" ] || [ "${SECURITY_SALT}" = "__SALT__" ]; then echo "SECURITY_SALT is not set. Generate one with: php -r \"echo bin2hex(random_bytes(32));\"" >&2 exit 1 fi php bin/cake.php migrations migrate php bin/cake.php cache clear_all exec php bin/cake.php server -H 0.0.0.0 -p "${PORT:-8765}"