Skip to content

Commit

Permalink
add health check
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrSaber committed Oct 11, 2024
1 parent 8009a5a commit 8ef9602
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ RUN bun --bun run build
# Run using bun
FROM oven/bun:1-alpine

# Health check
RUN apk add curl
HEALTHCHECK CMD curl -f "http://localhost:$PORT/api/health" || exit 1

# TODO: remove when graceful shutdown is handled
STOPSIGNAL SIGKILL

COPY --from=build /app/build /app

ENV PORT=80
EXPOSE 80
EXPOSE $PORT

WORKDIR /app
CMD ["bun", "/app/index.js"]
Binary file modified bun.lockb
Binary file not shown.
3 changes: 3 additions & 0 deletions src/routes/api/health/+server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export async function GET() {
return new Response('OK', { headers: { 'content-type': 'text/plain' } });
}

0 comments on commit 8ef9602

Please sign in to comment.