feat: Add HEALTHCHECK to Dockerfile template #16

Open
inv3ntor01 wants to merge 3 commits from inv3ntor01/healthcheck into main
inv3ntor01 commented 2026-06-18 01:42:12 +00:00 (Migrated from github.com)

Summary

Adds a Docker HEALTHCHECK instruction to the Laravel Dockerfile template so Docker and Kubernetes can verify the application is actually responding — not just that the process is alive.

Changes

  • resources/views/docker/php.blade.php
    • Added HEALTHCHECK in the deploy stage
    • Checks /health endpoint every 30 seconds
    • 40-second startup grace period (important for PHP-FPM boot)
    • 3 consecutive failures before marking unhealthy

Why this matters

Without HEALTHCHECK With HEALTHCHECK
Container shows "running" even if app is dead Docker knows if app is actually responding
Dead containers waste resources Unhealthy containers get restarted
K8s can't make intelligent restart decisions K8s respects health status

Testing

  • CI passes
  • Generated Dockerfile includes HEALTHCHECK
  • Health check responds correctly when app is up
## Summary Adds a Docker HEALTHCHECK instruction to the Laravel Dockerfile template so Docker and Kubernetes can verify the application is actually responding — not just that the process is alive. ## Changes - `resources/views/docker/php.blade.php` - Added HEALTHCHECK in the `deploy` stage - Checks `/health` endpoint every 30 seconds - 40-second startup grace period (important for PHP-FPM boot) - 3 consecutive failures before marking unhealthy ## Why this matters | Without HEALTHCHECK | With HEALTHCHECK | |---------------------|-----------------| | Container shows "running" even if app is dead | Docker knows if app is actually responding | | Dead containers waste resources | Unhealthy containers get restarted | | K8s can't make intelligent restart decisions | K8s respects health status | ## Testing - [ ] CI passes - [ ] Generated Dockerfile includes HEALTHCHECK - [ ] Health check responds correctly when app is up
This pull request has changes conflicting with the target branch.
  • app/Commands/ConsoleCommand.php
  • app/Commands/TrustCommand.php
  • app/Commands/UpCommand.php
  • app/Traits/InteractsWithDocker.php
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin inv3ntor01/healthcheck:inv3ntor01/healthcheck
git switch inv3ntor01/healthcheck

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff inv3ntor01/healthcheck
git switch inv3ntor01/healthcheck
git rebase main
git switch main
git merge --ff-only inv3ntor01/healthcheck
git switch inv3ntor01/healthcheck
git rebase main
git switch main
git merge --no-ff inv3ntor01/healthcheck
git switch main
git merge --squash inv3ntor01/healthcheck
git switch main
git merge --ff-only inv3ntor01/healthcheck
git switch main
git merge inv3ntor01/healthcheck
git push origin main
Sign in to join this conversation.
No description provided.