diff --git a/Dockerfile b/Dockerfile index 543bc86f6..1e999ed0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,10 @@ RUN apt-get -qq update && \ unzip \ wget +COPY ./healthcheck.sh /usr/bin/ +HEALTHCHECK --interval=300s --timeout=75s --start-period=30s --retries=3 \ + CMD ["/usr/bin/healthcheck.sh"] + # Configure sccache ENV SCCACHE_VERSION=0.5.4 RUN wget -q https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz \ diff --git a/healthcheck.sh b/healthcheck.sh new file mode 100644 index 000000000..ea6631292 --- /dev/null +++ b/healthcheck.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -e + +head () { + polkadot-js-api --ws ws://127.0.0.1:9944 query.system.number 2>/dev/null |\ + tail -3 |\ + jq -r .number +} + +start=$(head) +sleep 60 +end=$(head) + +[ "$start" != "$end" ]