diff --git a/dockerfile b/dockerfile index e98f930..a65610a 100644 --- a/dockerfile +++ b/dockerfile @@ -45,6 +45,9 @@ ENV NEXT_TELEMETRY_DISABLED 1 RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs +# Install curl for healthcheck +RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* + COPY --from=builder /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static @@ -55,4 +58,7 @@ EXPOSE 7777 ENV PORT 7777 ENV HOSTNAME "0.0.0.0" +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD curl -f http://localhost:7777/api/health || exit 1 + CMD ["node", "server.js"] \ No newline at end of file