-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
- Loading branch information
Showing
5 changed files
with
65 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Source: https://www.docker.com/blog/multi-arch-build-what-about-travis/ | ||
if [ -n "$DEBUG" ]; then | ||
set -x | ||
fi | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
export DOCKER_CLI_EXPERIMENTAL=enabled | ||
|
||
if ! docker buildx 2>&1 >/dev/null; then | ||
echo "buildx not available. Docker 19.03 or higher is required with experimental features enabled" | ||
exit 1 | ||
fi | ||
|
||
# We can skip setup if the current builder already has multi-arch | ||
# AND if it isn't the docker driver, which doesn't work | ||
current_builder="$(docker buildx inspect)" | ||
# linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6 | ||
if ! grep -q "^Driver: docker$" <<<"${current_builder}" && \ | ||
grep -q "linux/amd64" <<<"${current_builder}" && \ | ||
grep -q "linux/arm" <<<"${current_builder}" && \ | ||
grep -q "linux/arm64" <<<"${current_builder}"; then | ||
exit 0 | ||
fi | ||
|
||
# Ensure qemu is in binfmt_misc | ||
# Docker desktop already has these in versions recent enough to have buildx | ||
# We only need to do this setup on linux hosts | ||
if [ "$(uname)" == 'Linux' ]; then | ||
# NOTE: this is pinned to a digest for a reason! | ||
docker run --rm --privileged multiarch/qemu-user-static@sha256:28ebe2e48220ae8fd5d04bb2c847293b24d7fbfad84f0b970246e0a4efd48ad6 --reset -p yes | ||
fi | ||
|
||
# Ensure we use a builder that can leverage it (the default on linux will not) | ||
docker buildx create --use --name=multiarch --node multiarch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Source: https://www.docker.com/blog/multi-arch-build-what-about-travis/ | ||
|
||
sudo rm -rf /var/lib/apt/lists/* | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge" | ||
sudo apt-get update -qy | ||
sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce | ||
mkdir -vp ~/.docker/cli-plugins/ | ||
curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx | ||
chmod a+x ~/.docker/cli-plugins/docker-buildx | ||
sudo systemctl start docker | ||
|