File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,4 +32,10 @@ EXPOSE 3001
3232
3333WORKDIR /app/apps/api
3434
35+ COPY healthcheck.ts /app/healthcheck.ts
36+ ENV HEALTHCHECK_PORT=3001
37+
38+ HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
39+ CMD ["bun" , "/app/healthcheck.ts" ]
40+
3541CMD ["bun" , "run" , "src/index.ts" ]
Original file line number Diff line number Diff line change @@ -27,14 +27,20 @@ RUN bun build \
2727 --bytecode \
2828 ./src/index.ts
2929
30- FROM gcr.io/ distroless/cc
30+ FROM oven/bun:1.3.4- distroless
3131
3232WORKDIR /app
3333
3434COPY --from=build /app/server server
35+ COPY healthcheck.ts healthcheck.ts
3536
3637ENV NODE_ENV=production
38+ ENV HEALTHCHECK_PORT=4000
3739
40+ HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
41+ CMD ["bun" , "/app/healthcheck.ts" ]
42+
43+ ENTRYPOINT []
3844CMD ["./server" ]
3945
4046EXPOSE 4000
Original file line number Diff line number Diff line change 1+ const port = process . env . HEALTHCHECK_PORT ?? process . env . PORT ?? "3000" ;
2+ const r = await fetch ( `http://localhost:${ port } /health` ) ;
3+ process . exit ( r . ok ? 0 : 1 ) ;
Original file line number Diff line number Diff line change @@ -28,14 +28,20 @@ RUN bun build \
2828 --bytecode \
2929 ./src/index.ts
3030
31- FROM gcr.io/ distroless/base
31+ FROM oven/bun:1.3.4- distroless
3232
3333WORKDIR /app
3434
3535COPY --from=build /app/server server
36+ COPY healthcheck.ts healthcheck.ts
3637
3738ENV NODE_ENV=production
39+ ENV HEALTHCHECK_PORT=2500
3840
41+ HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
42+ CMD ["bun" , "/app/healthcheck.ts" ]
43+
44+ ENTRYPOINT []
3945CMD ["./server" ]
4046
4147EXPOSE 2500
Original file line number Diff line number Diff line change @@ -23,14 +23,20 @@ RUN bun build \
2323 --bytecode \
2424 ./apps/uptime/src/index.ts
2525
26- FROM gcr.io/ distroless/base
26+ FROM oven/bun:1.3.4- distroless
2727
2828WORKDIR /app
2929
3030COPY --from=build /app/server server
31+ COPY healthcheck.ts healthcheck.ts
3132
3233ENV NODE_ENV=production
34+ ENV HEALTHCHECK_PORT=4000
3335
36+ HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
37+ CMD ["bun" , "/app/healthcheck.ts" ]
38+
39+ ENTRYPOINT []
3440CMD ["./server" ]
3541
3642EXPOSE 4000
You can’t perform that action at this time.
0 commit comments