From 6d9e5ae56f6dd2cf693bb82a26f310366add0a99 Mon Sep 17 00:00:00 2001 From: nomi-nonsz Date: Sat, 22 Nov 2025 09:37:37 +0700 Subject: [PATCH] Add health check --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c8b0a44..a5d89f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM node:20-alpine AS builder -RUN apk add --no-cache yarn +RUN apk add --no-cache yarn curl WORKDIR /app @@ -20,7 +20,7 @@ WORKDIR /app RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs -ENV NODE_ENV production +ENV NODE_ENV=production USER nextjs @@ -30,4 +30,7 @@ COPY --from=builder /app/.next/static ./.next/static EXPOSE 3000 +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=5 \ + CMD curl -f http://localhost:3000 || exit 1 + CMD ["node", "server.js"] \ No newline at end of file