-
Notifications
You must be signed in to change notification settings - Fork 185
feat: add healthchecks to Dockerfiles for api, basket, links, and uptime services #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,3 @@ | ||||||||||||||||||
| const port = process.env.HEALTHCHECK_PORT ?? process.env.PORT ?? "3000"; | ||||||||||||||||||
| const r = await fetch(`http://localhost:${port}/health`); | ||||||||||||||||||
| process.exit(r.ok ? 0 : 1); | ||||||||||||||||||
|
Comment on lines
+2
to
+3
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A try/catch makes the failure mode explicit:
Suggested change
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convention is to declare
ENTRYPOINTbeforeHEALTHCHECK(andCMD) so the intended runtime contract is clear before the health probe is defined. Docker processes these as a final metadata set so this doesn't break anything, but the ordering is slightly unexpected for readers.The same ordering applies to
links.Dockerfileanduptime.Dockerfile.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!