add health endpoint

This commit is contained in:
fccview
2026-05-12 14:15:59 +01:00
parent d260f2d5db
commit b81ecb099f
3 changed files with 12 additions and 0 deletions

View File

@@ -48,6 +48,9 @@ EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:3000/api/health || exit 1
USER nextjs
CMD ["node", "server.js"]

3
app/api/health/route.ts Normal file
View File

@@ -0,0 +1,3 @@
import { NextResponse } from "next/server";
export const GET = () => NextResponse.json({ status: "healthy" });

View File

@@ -22,3 +22,9 @@ services:
privileged: true
restart: always
init: true
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3