forked from docker-library/busybox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·38 lines (32 loc) · 1 KB
/
build.sh
File metadata and controls
executable file
·38 lines (32 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
set -Eeuo pipefail
[ -f versions.json ] # run "versions.sh" first
if [ "$#" -eq 0 ]; then
dirs="$(jq -r 'to_entries | map(.key + "/" + (.value.variants[])) | map(@sh) | join(" ")' versions.json)"
eval "set -- $dirs"
fi
for dir; do
base="busybox:${dir////-}"
(
set -x
docker build -t "$base-builder" -f "$dir/Dockerfile.builder" "$dir"
docker run --rm "$base-builder" tar cC rootfs . | xz -T0 -z9 > "$dir/busybox.tar.xz"
docker build -t "$base-test" "$dir"
docker run --rm "$base-test" sh -xec 'true'
# detect whether the current host _can_ ping
# (QEMU user-mode networking does not route ping traffic)
shouldPing=
if docker run --rm "$base-builder" ping -c 1 google.com &> /dev/null; then
shouldPing=1
fi
if [ -n "$shouldPing" ]; then
if ! docker run --rm "$base-test" ping -c 1 google.com; then
sleep 1
docker run --rm "$base-test" ping -c 1 google.com
fi
else
docker run --rm "$base-test" nslookup google.com
fi
docker images "$base-test"
)
done