mirror of
https://github.com/DumbWareio/DumbWhoIs.git
synced 2026-01-09 06:11:19 +08:00
feat: container health-check
This commit is contained in:
parent
a5799cb22d
commit
e459a7d9e3
@ -14,5 +14,8 @@ COPY --from=builder /app .
|
|||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Health check
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s CMD wget -qO- http://localhost:3000/health || exit 1
|
||||||
|
|
||||||
# Start the application
|
# Start the application
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
@ -414,6 +414,14 @@ app.get('/managers/toast', (req, res) => {
|
|||||||
res.sendFile(path.join(PUBLIC_DIR, 'managers', 'toast.js'));
|
res.sendFile(path.join(PUBLIC_DIR, 'managers', 'toast.js'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/health', (_req, res) => {
|
||||||
|
res.json({
|
||||||
|
status: 'ok',
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
uptime: process.uptime()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
app.get('*', (req, res) => {
|
app.get('*', (req, res) => {
|
||||||
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user