Skip to content

Commit

Permalink
Merge pull request #558 from openziti/557-arm64-containers-have-the-a…
Browse files Browse the repository at this point in the history
…rmhf-binary-should-be-aarch64

download arm64 binary if aarch64, not arm
  • Loading branch information
qrkourier authored Nov 23, 2022
2 parents 79289ca + a70f1f6 commit 5e74934
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
18 changes: 14 additions & 4 deletions docker/buildx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ EOF
DIRNAME=$(dirname "$0") || exit $?
EXIT=0

while getopts :r:chlf OPT;do
while getopts :r:chlfP OPT;do
case $OPT in
r) CONTAINER_REPO=$OPTARG
;;
Expand All @@ -60,7 +60,9 @@ while getopts :r:chlf OPT;do
;;
l) FLAGS+=$OPT # also tag and push latest
;;
f) FLAGS+=$OPT
f) FLAGS+=$OPT # clobber existing tag(s) in Hub
;;
P) FLAGS+=$OPT # don't push container image to Hub
;;
\?|*) _usage 1 # error
;;
Expand Down Expand Up @@ -91,19 +93,27 @@ if [[ ${FLAGS:-} =~ l ]]; then
TAG_PARAMS+=" --tag=\"${CONTAINER_REPO}:latest\""
fi

if [[ ${FLAGS:-} =~ P ]]; then
# if no push then load in image cache
BUILDX_OUTPUT=""
else
# default is push to Hub
BUILDX_OUTPUT="--push"
fi

docker run --rm --privileged tonistiigi/binfmt:qemu-v6.2.0
grep -E -q 'enabled' /proc/sys/fs/binfmt_misc/qemu-arm
docker run --rm --platform linux/arm64/v8 arm64v8/alpine uname -a | grep -Eq 'aarch64 Linux'
docker run --rm --platform linux/arm/v7 arm32v7/alpine uname -a | grep -Eq 'armv7l Linux'
docker buildx create --use --name=ziti-builder 2>/dev/null || docker buildx use --default ziti-builder

# if
if [[ ${FLAGS:-} =~ f ]] || ! curl -sSLf https://registry.hub.docker.com/v2/repositories/${CONTAINER_REPO}/tags/${ZITI_VERSION} &>/dev/null; then
if [[ ${FLAGS:-} =~ P ]] || [[ ${FLAGS:-} =~ f ]] || ! curl -sSLf https://registry.hub.docker.com/v2/repositories/${CONTAINER_REPO}/tags/${ZITI_VERSION} &>/dev/null; then
eval docker buildx build "${DIRNAME}" \
--platform="linux/amd64,linux/arm/v7,linux/arm64" \
--build-arg=ZITI_VERSION="${ZITI_VERSION}" \
"${TAG_PARAMS}" \
--push
"${BUILDX_OUTPUT}"
else
echo "ERROR: Docker tag ziti-edge-tunnel:${ZITI_VERSION} already exists. Carefully send option -f to clobber Docker image tag." >&2
EXIT=1
Expand Down
3 changes: 2 additions & 1 deletion docker/fetch-github-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ fi
host_arch=$(uname -m)
case "${host_arch}" in
"x86_64") artifact_arch="x86_64";;
"armv7l"|"aarch64") artifact_arch="arm";;
"armv7l") artifact_arch="arm";;
"aarch64") artifact_arch="arm64";;
*) echo "ERROR: Ziti binaries do not exist for architecture ${host_arch}"; exit 1;;
esac

Expand Down

0 comments on commit 5e74934

Please sign in to comment.