Update to opendev.org in tox.ini
[functest-xtesting.git] / build.sh
1 #!/bin/bash
2
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 # http://www.apache.org/licenses/LICENSE-2.0
7
8 set -xe
9
10 repo=${REPO:-opnfv}
11 tag=${BRANCH:-gambia}
12 arch=${arch-"\
13 amd64 \
14 arm64"}
15 image="xtesting"
16 build_opts=(--pull=true --no-cache --force-rm=true)
17
18 for arch in ${arch};do
19     if [[ ${arch} == arm64 ]]; then
20         find . -name Dockerfile -exec sed -i \
21             -e "s|alpine:3.8|multiarch/alpine:arm64-v3.8|g" {} +
22     fi
23     (cd docker &&   docker build "${build_opts[@]}" \
24         -t "${repo}/${image}:${arch}-${tag}" .)
25     docker push "${repo}/${image}:${arch}-${tag}"
26     [ "$?" == "0" ] &&
27         (sudo docker rmi "${repo}/${image}:${arch}-${tag}"|| true)
28     find . -name Dockerfile -exec git checkout \{\} +;
29 done
30 exit $?