diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 49e9e56..8bf31c9 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -16,6 +16,7 @@ RUN pnpm install --frozen-lockfile --filter @menulio/api... RUN pnpm --filter @menulio/api build FROM node:22-alpine AS runner +RUN apk add --no-cache curl wget libc6-compat WORKDIR /app ENV NODE_ENV=production @@ -34,4 +35,7 @@ USER fastify EXPOSE 3000 +HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \ + CMD curl -f http://localhost:3000/health || exit 1 + CMD ["node", "apps/api/dist/index.js"] diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 8c8643d..038983d 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -41,6 +41,7 @@ RUN pnpm --filter @menulio/web build # 3. Production runner FROM node:22-alpine AS runner +RUN apk add --no-cache curl wget libc6-compat WORKDIR /app ENV NODE_ENV=production @@ -60,4 +61,7 @@ USER nextjs EXPOSE 3000 +HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \ + CMD curl -f http://localhost:3000/api/health || exit 1 + CMD ["node", "apps/web/server.js"] diff --git a/apps/web/src/app/api/health/route.ts b/apps/web/src/app/api/health/route.ts new file mode 100644 index 0000000..6317528 --- /dev/null +++ b/apps/web/src/app/api/health/route.ts @@ -0,0 +1,5 @@ +import { NextResponse } from "next/server"; + +export async function GET() { + return NextResponse.json({ status: "ok", timestamp: new Date().toISOString() }); +}