Add a consistent ARM64 image build process

Signed-off-by: Radoslav Dimitrov <rdimitrow@gmail.com>
This commit is contained in:
Radoslav Dimitrov 2018-12-03 00:20:34 +02:00 committed by Alex Ellis
parent 33800a20d8
commit 41b452849c
4 changed files with 30 additions and 4 deletions

View File

@ -1,10 +1,12 @@
.PHONY: build build-gateway test-ci .PHONY: build build-gateway test-ci ci-armhf-build ci-armhf-push ci-arm64-build ci-arm64-push
TAG?=latest TAG?=latest
build: build:
./build.sh ./build.sh
build-gateway: build-gateway:
(cd gateway; ./build.sh latest-dev) (cd gateway; ./build.sh latest-dev)
test-ci: test-ci:
./contrib/ci.sh ./contrib/ci.sh
@ -13,3 +15,9 @@ ci-armhf-build:
ci-armhf-push: ci-armhf-push:
(cd gateway; ./push.sh $(TAG)) (cd gateway; ./push.sh $(TAG))
ci-arm64-build:
(cd gateway; ./build.sh $(TAG))
ci-arm64-push:
(cd gateway; ./push.sh $(TAG))

View File

@ -2,6 +2,7 @@
declare -a repos=("openfaas-incubator/openfaas-operator" "openfaas-incubator/faas-idler" "openfaas/faas" "openfaas/faas-swarm" "openfaas/nats-queue-worker" "openfaas/faas-netes" "openfaas/faas-cli") declare -a repos=("openfaas-incubator/openfaas-operator" "openfaas-incubator/faas-idler" "openfaas/faas" "openfaas/faas-swarm" "openfaas/nats-queue-worker" "openfaas/faas-netes" "openfaas/faas-cli")
HERE=`pwd` HERE=`pwd`
ARCH=$(uname -m)
#if [ ! -z "$CACHED" ]; then #if [ ! -z "$CACHED" ]; then
rm -rf staging || : rm -rf staging || :
@ -24,6 +25,14 @@ get_repo_name() {
fi fi
} }
if [ "$ARCH" = "armv7l" ] ; then
ARM_VERSION="armhf"
elif [ "$ARCH" = "aarch64" ] ; then
ARM_VERSION="arm64"
fi
echo "Target architecture: ${ARM_VERSION}"
for i in "${repos[@]}" for i in "${repos[@]}"
do do
cd $HERE cd $HERE
@ -36,11 +45,11 @@ do
echo "Latest release: $TAG" echo "Latest release: $TAG"
REPOSITORY=$(get_repo_name $i) REPOSITORY=$(get_repo_name $i)
TAG_PRESENT=$(curl -s "https://hub.docker.com/v2/repositories/${REPOSITORY}/tags/${TAG}-armhf/" | grep -Po '"detail": *"[^"]*"' | grep -o 'Not found') TAG_PRESENT=$(curl -s "https://hub.docker.com/v2/repositories/${REPOSITORY}/tags/${TAG}-${ARM_VERSION}/" | grep -Po '"detail": *"[^"]*"' | grep -o 'Not found')
if [ "$TAG_PRESENT" = "Not found" ]; then if [ "$TAG_PRESENT" = "Not found" ]; then
make ci-armhf-build ci-armhf-push make ci-${ARM_VERSION}-build ci-${ARM_VERSION}-push
else else
echo "Image is already present: ${REPOSITORY}:${TAG}-armhf" echo "Image is already present: ${REPOSITORY}:${TAG}-${ARM_VERSION}"
fi fi
done done

View File

@ -9,6 +9,9 @@ export eTAG="latest-dev"
if [ "$arch" = "armv7l" ] ; then if [ "$arch" = "armv7l" ] ; then
dockerfile="Dockerfile.armhf" dockerfile="Dockerfile.armhf"
eTAG="latest-armhf-dev" eTAG="latest-armhf-dev"
elif [ "$arch" = "aarch64" ] ; then
dockerfile="Dockerfile.arm64"
eTAG="latest-arm64-dev"
fi fi
echo "$1" echo "$1"
@ -16,6 +19,8 @@ if [ "$1" ] ; then
eTAG=$1 eTAG=$1
if [ "$arch" = "armv7l" ] ; then if [ "$arch" = "armv7l" ] ; then
eTAG="$1-armhf" eTAG="$1-armhf"
elif [ "$arch" = "aarch64" ] ; then
eTAG="$1-arm64"
fi fi
fi fi

View File

@ -7,6 +7,8 @@ export eTAG="latest-dev"
if [ "$arch" = "armv7l" ] ; then if [ "$arch" = "armv7l" ] ; then
eTAG="latest-armhf-dev" eTAG="latest-armhf-dev"
elif [ "$arch" = "aarch64" ] ; then
eTAG="latest-arm64-dev"
fi fi
echo "$1" echo "$1"
@ -14,6 +16,8 @@ if [ "$1" ] ; then
eTAG=$1 eTAG=$1
if [ "$arch" = "armv7l" ] ; then if [ "$arch" = "armv7l" ] ; then
eTAG="$1-armhf" eTAG="$1-armhf"
elif [ "$arch" = "aarch64" ] ; then
eTAG="$1-arm64"
fi fi
fi fi