#!/bin/bash
-set -e
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
-repo=${repo:-opnfv}
+set -xe
-(cd docker && docker build -t "${repo}/functest" .)
-docker push "${repo}/functest"
+repo=${REPO:-opnfv}
+tag=${BRANCH:-hunter}
+arch=${arch-"\
+amd64 \
+arm64 \
+arm"}
+image="xtesting"
+build_opts=(--pull=true --no-cache --force-rm=true)
-for dir in docker/core docker/healthcheck docker/smoke docker/features; do
- (cd ${dir} && docker build -t "${repo}/functest-${dir##**/}" .)
- docker push "${repo}/functest-${dir##**/}"
+for arch in ${arch};do
+ if [[ ${arch} == arm64 ]]; then
+ find . -name Dockerfile -exec sed -i \
+ -e "s|alpine:3.9|multiarch/alpine:arm64-v3.9|g" {} +
+ elif [[ ${arch} == arm ]]; then
+ find . -name Dockerfile -exec sed -i \
+ -e "s|alpine:3.9|multiarch/alpine:armhf-v3.9|g" {} +
+ fi
+ (cd docker && docker build "${build_opts[@]}" \
+ -t "${repo}/${image}:${arch}-${tag}" .)
+ docker push "${repo}/${image}:${arch}-${tag}"
+ [ "$?" == "0" ] &&
+ (sudo docker rmi "${repo}/${image}:${arch}-${tag}"|| true)
+ find . -name Dockerfile -exec git checkout \{\} +;
done
-
exit $?