From 05df53fc87ca782c999844f87a3572a209202b4c Mon Sep 17 00:00:00 2001 From: Shawn Carey Date: Fri, 4 Sep 2020 08:53:44 -0400 Subject: [PATCH] Add arm/v8 to list of targeted Docker platforms. (#188) --- ziti-tunnel/docker/BUILD.md | 29 ++++++++++++++++----------- ziti-tunnel/docker/Dockerfile | 4 +++- ziti-tunnel/docker/fetch-ziti-bins.sh | 6 ++++-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/ziti-tunnel/docker/BUILD.md b/ziti-tunnel/docker/BUILD.md index aed113e0a..6de5c8668 100644 --- a/ziti-tunnel/docker/BUILD.md +++ b/ziti-tunnel/docker/BUILD.md @@ -31,7 +31,7 @@ the image to a public registry. This is taken care of by Docker Desktop if you're building on macOS or Windows, but you'll need to install qemu emulation support and register Arm binaries to - run on your (presumably) x88 build host if you are running Docker CE on Linux: + run on your (presumably) x86_64 build host if you are running Docker CE on Linux: $ sudo dnf install -y qemu-system-arm $ docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d @@ -53,21 +53,26 @@ the image to a public registry. Run `docker buildx` like this: - $ ziti_version="0.5.8-2554" + $ ziti_version="0.15.3" $ docker buildx build \ - --platform linux/amd64,linux/arm/v7 \ + --platform linux/amd64,linux/arm/v7,linux/arm/v8 \ --build-arg ZITI_VERSION="${ziti_version}" \ -t "netfoundry/ziti-tunnel:${ziti_version}" . -Note that you'll need to append "--push" to this command to be able to use -the image locally. +Notes: -Unfortunately `buildx` doesn't currently support building images directly into -the local docker cache. Although the `--load` and `--output=type=docker` options -exist, the underlying capability will be implemented in a future docker release -(see https://github.com/docker/buildx/issues/59). In the meantime, you'll need -to push your image builds (with the `--push` build option) and then pull them to -run the image locally when building with `buildx`. +- You'll need to append "--push" to this command, and then subsequently pull the + image to be able to use the image locally. + + Unfortunately `buildx` doesn't currently support building images directly into + the local docker cache. Although the `--load` and `--output=type=docker` options + exist, the underlying capability will be implemented in a future docker release + (see https://github.com/docker/buildx/issues/59). In the meantime, you'll need + to push your image builds (with the `--push` build option) and then pull them to + run the image locally when building with `buildx`. + +- The armv8 image uses armv7 (32-bit) ziti executables. The 32-bit compatibility + libraries are installed in the image, but your Arm CPU must support 32-bit emulation. ## References: @@ -83,7 +88,7 @@ This build method produces an image for the CPU that is running the build host (typically amd64), and places the resulting image into your local Docker image cache. - $ ziti_version="0.5.8-2554" \ + $ ziti_version="0.15.3" \ $ docker build \ --build-arg ZITI_VERSION="${ziti_version}" \ -t "netfoundry/ziti-tunnel:${ziti_version}" . \ No newline at end of file diff --git a/ziti-tunnel/docker/Dockerfile b/ziti-tunnel/docker/Dockerfile index c0727dd1e..16a7ec772 100644 --- a/ziti-tunnel/docker/Dockerfile +++ b/ziti-tunnel/docker/Dockerfile @@ -2,7 +2,7 @@ FROM debian:stable-slim as fetch-ziti-artifacts # This build stage grabs artifacts that are copied into the final image. # It uses the same base as the final image to maximize docker cache hits. -ARG ZITI_VERSION="0.5.8-2554" +ARG ZITI_VERSION="0.15.3" ARG ARTIFACTORY_TOKEN ARG ARTIFACTORY_BASE_URL="https://netfoundry.jfrog.io/netfoundry" @@ -28,6 +28,8 @@ FROM debian:stable-slim RUN mkdir -p /usr/local/bin /etc/ssl/certs RUN apt-get -q update && apt-get -q install -y --no-install-recommends iptables +# Use 32-bit arm binaries on arm64 until we have 64-bit arm builds. This also affects fetch-ziti-bins.sh. +RUN if [ "$(uname -m)" = "aarch64" ]; then dpkg --add-architecture armhf; apt update; apt install -y libc6:armhf; fi COPY --from=fetch-ziti-artifacts /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs COPY --from=fetch-ziti-artifacts /tmp/ziti-tunnel /usr/local/bin COPY --from=fetch-ziti-artifacts /tmp/ziti-enroller /usr/local/bin diff --git a/ziti-tunnel/docker/fetch-ziti-bins.sh b/ziti-tunnel/docker/fetch-ziti-bins.sh index a4877e245..8d879e92b 100755 --- a/ziti-tunnel/docker/fetch-ziti-bins.sh +++ b/ziti-tunnel/docker/fetch-ziti-bins.sh @@ -18,7 +18,7 @@ done host_arch=$(uname -m) case "${host_arch}" in "x86_64") artifact_arch="amd64";; -"armv7l") artifact_arch="arm";; +"armv7l"|"aarch64") artifact_arch="arm";; *) echo "ERROR: ziti binaries do not exist for architecture ${host_arch}"; exit 1;; esac @@ -44,5 +44,7 @@ for exe in "${@}"; do exit 1 fi tar -xzf "${exe}.tar.gz" + if [ -f "${exe}" ]; then chmod 755 "${exe}"; fi + if [ -f "${exe}.exe" ]; then chmod 755 "${exe}.exe"; fi rm "${exe}.tar.gz" -done \ No newline at end of file +done