Skip to content

Commit

Permalink
modified healthcheck to use only netcat
Browse files Browse the repository at this point in the history
  • Loading branch information
mortee committed Dec 4, 2024
1 parent 78bbf5f commit d39c39e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FROM debian:bookworm-20241016-slim AS runtime

RUN useradd -c 'atuin user' atuin && mkdir /config && chown atuin:atuin /config
# Install ca-certificates for webhooks to work
RUN apt update && apt install ca-certificates curl jq -y && rm -rf /var/lib/apt/lists/*
RUN apt update && apt install ca-certificates netcat-traditional -y && rm -rf /var/lib/apt/lists/*
WORKDIR app

USER atuin
Expand All @@ -30,5 +30,6 @@ ENV RUST_LOG=atuin::api=info
ENV ATUIN_CONFIG_DIR=/config

COPY --from=builder /app/target/release/atuin /usr/local/bin
HEALTHCHECK CMD curl -sSf http://localhost:8888 | jq .version || exit 1
COPY healthcheck.sh /
HEALTHCHECK CMD /healthcheck.sh
ENTRYPOINT ["/usr/local/bin/atuin"]
3 changes: 3 additions & 0 deletions healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/sh

printf 'GET / HTTP/1.1\n\n\n\n' | nc -q 10 localhost 8888 | sed -En 's/^.*,"(version)":"([^"]*)".*$/\1: \2/p' | grep version || exit 1

0 comments on commit d39c39e

Please sign in to comment.