From 0eae9bc0bb75200c655af38ed82d0fb5db51a5a6 Mon Sep 17 00:00:00 2001 From: hywax Date: Fri, 19 Apr 2024 21:22:47 +0500 Subject: [PATCH] feat!: docker health check (#92) --- Dockerfile | 2 ++ src/server/api/health.ts | 1 + 2 files changed, 3 insertions(+) create mode 100644 src/server/api/health.ts diff --git a/Dockerfile b/Dockerfile index 65eeb59..53b2983 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,4 +25,6 @@ COPY --from=build /app/.output /app EXPOSE 3000/tcp +HEALTHCHECK --interval=10s --timeout=5s --start-period=10s CMD node -e "require('http').get('http://localhost:3000/api/health', res => process.exit(res.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))" + CMD ["/app/server/index.mjs"] diff --git a/src/server/api/health.ts b/src/server/api/health.ts new file mode 100644 index 0000000..c6374d9 --- /dev/null +++ b/src/server/api/health.ts @@ -0,0 +1 @@ +export default defineEventHandler(() => '')