Custom boot scripts
You can hook into the entrypoint boot process by mounting custom script directories. The scripts are executed in alphabetical order within each phase.
| Mount point | When it runs |
|---|---|
/custom-scripts/before-boot | Very early — after the banner, before xdebug/nginx/laravel boot |
/custom-scripts/after-boot | Very late — after PHP READY, before container wait_forever |
Compose example
yaml
services:
php:
volumes:
- ./docker/before-boot:/custom-scripts/before-boot
- ./docker/after-boot:/custom-scripts/after-bootNotes
- Each script must have the
.shextension to be picked up. - Scripts are executed with
bash, errors do not abort the boot (|| true). - Use
before-bootfor setup that needs to happen before Laravel runs (e.g., wait for an external service, prepare a directory). - Use
after-bootfor tasks that need a fully-booted Laravel (e.g., cache warmup, post-deploy hooks).