mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
727982d2f9
Also added a whole bunch of logging that I needed while debugging the issue. The solution in the end is that bootstrap needs to resolve IPs, and getaddrinfo fails in the browser. Most of the time we bootstrap against IPs anyway, so trying to parse as IP address first will shortcut that.
26 lines
773 B
Bash
Executable File
26 lines
773 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eux
|
|
|
|
docker_build() {
|
|
readarray -t FILES <<<"$(git ls-files)"
|
|
tar c "${FILES[@]}" | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node -
|
|
}
|
|
|
|
# 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.
|
|
OUTPUT=$(docker_build || true 2>&1)
|
|
|
|
if echo "$OUTPUT" | grep '/usr/local/bin/tox-bootstrapd: FAILED'; then
|
|
# This is a checksum warning, so we need to update it.
|
|
IMAGE=$(echo "$OUTPUT" | grep '^ ---> [0-9a-f]*$' | grep -o '[0-9a-f]*$' | tail -n1)
|
|
docker run --rm "$IMAGE" sha256sum /usr/local/bin/tox-bootstrapd >other/bootstrap_daemon/docker/tox-bootstrapd.sha256
|
|
fi
|
|
|
|
# Run once last time to complete the build.
|
|
docker_build
|