From 122a8213bc5270a28cb192a73f042bfb1cbc7bf8 Mon Sep 17 00:00:00 2001 From: Jibbajabbafic Date: Fri, 27 Oct 2023 22:13:41 +0100 Subject: [PATCH] feat(docker): add healthcheck --- Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Dockerfile b/Dockerfile index c94db39..4266d7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,5 +17,12 @@ RUN cargo build --release # We do not need the Rust toolchain to run the binary! FROM debian:bullseye-slim AS runtime WORKDIR /app + +# Install curl for healthcheck +RUN apt update && apt install -y curl + +HEALTHCHECK --interval=1m --timeout=10s --retries=3 --start-period=1m \ + CMD curl --fail localhost:3000/api/list/servers || exit 1 + COPY --from=builder /app/target/release/game_server_list /usr/local/bin ENTRYPOINT ["/usr/local/bin/game_server_list"]