File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,14 @@ FROM ubuntu:22.04 as runtime
2929
3030WORKDIR /
3131
32- RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates
32+ # curl is needed for healthcheck
33+ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates curl
3334
3435COPY --from=build /app/target/release/bors .
3536
3637EXPOSE 80
3738
39+ HEALTHCHECK --timeout=10s --start-period=10s \
40+ CMD curl -f http://localhost/health || exit 1
41+
3842ENTRYPOINT ["./bors" ]
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use anyhow::Error;
88use axum:: extract:: State ;
99use axum:: http:: StatusCode ;
1010use axum:: response:: IntoResponse ;
11- use axum:: routing:: post;
11+ use axum:: routing:: { get , post} ;
1212use axum:: Router ;
1313use octocrab:: Octocrab ;
1414use std:: future:: Future ;
@@ -47,10 +47,15 @@ pub type ServerStateRef = Arc<ServerState>;
4747pub fn create_app ( state : ServerState ) -> Router {
4848 Router :: new ( )
4949 . route ( "/github" , post ( github_webhook_handler) )
50+ . route ( "/health" , get ( health_handler) )
5051 . layer ( ConcurrencyLimitLayer :: new ( 100 ) )
5152 . with_state ( Arc :: new ( state) )
5253}
5354
55+ async fn health_handler ( ) -> impl IntoResponse {
56+ ( StatusCode :: OK , "" )
57+ }
58+
5459/// Axum handler that receives a webhook and sends it to a webhook channel.
5560pub async fn github_webhook_handler (
5661 State ( state) : State < ServerStateRef > ,
You can’t perform that action at this time.
0 commit comments