summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon/docker/update-sha256
diff options
context:
space:
mode:
Diffstat (limited to 'other/bootstrap_daemon/docker/update-sha256')
-rwxr-xr-xother/bootstrap_daemon/docker/update-sha25624
1 files changed, 24 insertions, 0 deletions
diff --git a/other/bootstrap_daemon/docker/update-sha256 b/other/bootstrap_daemon/docker/update-sha256
new file mode 100755
index 00000000..78aa656f
--- /dev/null
+++ b/other/bootstrap_daemon/docker/update-sha256
@@ -0,0 +1,24 @@
1#!/bin/sh
2
3set -eux
4
5docker_build() {
6 tar c $(git ls-files) | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node -
7}
8
9# Run Docker build once. If it succeeds, we're good.
10if docker_build; then
11 exit 0
12fi
13
14# We're not good. Run it again, but now capture the output.
15OUTPUT=$(docker_build || true 2>&1)
16
17if echo "$OUTPUT" | grep '/usr/local/bin/tox-bootstrapd: FAILED'; then
18 # This is a checksum warning, so we need to update it.
19 IMAGE=$(echo "$OUTPUT" | grep '^ ---> [0-9a-f]*$' | grep -o '[0-9a-f]*$' | tail -n1)
20 docker run --rm "$IMAGE" sha256sum /usr/local/bin/tox-bootstrapd > other/bootstrap_daemon/docker/tox-bootstrapd.sha256
21fi
22
23# Run once last time to complete the build.
24docker_build