2022-02-02 21:03:01 +08:00
|
|
|
#!/usr/bin/env bash
|
2020-05-03 03:49:41 +08:00
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
|
|
|
docker_build() {
|
2023-12-02 11:42:20 +08:00
|
|
|
DOCKER_BUILDKIT=1 docker build --progress=plain -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node .
|
2020-05-03 03:49:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Run Docker build once. If it succeeds, we're good.
|
|
|
|
if docker_build; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# We're not good. Run it again, but now capture the output.
|
2023-12-02 11:42:20 +08:00
|
|
|
OUTPUT=$(docker_build 2>&1 || true)
|
2020-05-03 03:49:41 +08:00
|
|
|
|
|
|
|
if echo "$OUTPUT" | grep '/usr/local/bin/tox-bootstrapd: FAILED'; then
|
|
|
|
# This is a checksum warning, so we need to update it.
|
2023-12-02 11:42:20 +08:00
|
|
|
echo "$OUTPUT" | grep -Eo '[0-9a-f]{64} /usr/local/bin/tox-bootstrapd' | tail -n1 >other/bootstrap_daemon/docker/tox-bootstrapd.sha256
|
2020-05-03 03:49:41 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Run once last time to complete the build.
|
|
|
|
docker_build
|