-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
executable file
·51 lines (44 loc) · 1.13 KB
/
build.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash -eu
imagetag="docker-acap-with-compose:1.0"
function exit_with_message {
echo "$1"
echo
echo "Usage: $0 ARCH [ --plain ] [ --cache ] [ --image-tag IMAGETAG ]"
echo
echo "ARCH must be 'armv7hf' or 'aarch64'"
echo "--plain will simplify the Docker progress bar."
echo "--cache will enable Docker's caching mechanism."
echo "--image-tag sets the supplied tag of the image. Default is $imagetag."
exit 1
}
arch="${1:-}"
case "$arch" in
armv7hf | aarch64) ;;
*) exit_with_message "Invalid architecture '$arch'" ;;
esac
shift
progress_arg=
cache_arg=--no-cache
while (($#)); do
case "$1" in
--plain) progress_arg="--progress plain" ;;
--cache) cache_arg= ;;
--image-tag)
shift
imagetag="$1"
;;
*) exit_with_message "Invalid argument '$1'" ;;
esac
shift
done
# Build and copy out the acap
# shellcheck disable=SC2086
docker buildx build --build-arg ARCH="$arch" \
--build-arg HTTP_PROXY="${HTTP_PROXY:-}" \
--build-arg HTTPS_PROXY="${HTTPS_PROXY:-}" \
--build-arg BUILD_WITH_SANITIZERS="${BUILD_WITH_SANITIZERS:-}" \
--file Dockerfile \
$progress_arg \
$cache_arg \
--tag "$imagetag" \
--output build-"$arch" .