Add build.sh for functest-xtesting 35/53235/5
authorDelia Popescu <delia.popescu@enea.com>
Wed, 7 Mar 2018 10:04:18 +0000 (12:04 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Fri, 9 Mar 2018 08:39:40 +0000 (09:39 +0100)
JIRA: FUNCTEST-948

Change-Id: If174ac0cc5716ccd6f5bcd6b5627feb222d05b0b
Signed-off-by: Delia Popescu <delia.popescu@enea.com>
build.sh [new file with mode: 0644]

diff --git a/build.sh b/build.sh
new file mode 100644 (file)
index 0000000..b78f108
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# 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
+
+set -xe
+
+repo=${REPO:-opnfv}
+tag=${BRANCH:-latest}
+arch=${arch_tag-"\
+amd64 \
+arm64"}
+image="xtesting"
+build_opts=(--pull=true --no-cache --force-rm=true)
+
+for arch in ${arch};do
+    if [[ ${arch} == arm64 ]]; then
+        find . -name Dockerfile -exec sed -i -e "s|alpine:3.7|multiarch/alpine:arm64-v3.7|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 $?