aboutsummaryrefslogtreecommitdiffstats
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rw-r--r--build.sh36
1 files changed, 30 insertions, 6 deletions
diff --git a/build.sh b/build.sh
index 3c155594..f6aaa492 100644
--- a/build.sh
+++ b/build.sh
@@ -8,27 +8,51 @@
set -xe
repo=${REPO:-opnfv}
-tag=${BRANCH:-latest}
arch=${arch-"\
amd64 \
arm64 \
arm"}
+amd64_dirs=${amd64_dirs-"\
+docker/core \
+docker/mts"}
+arm_dirs=${arm_dirs-${amd64_dirs}}
+arm64_dirs=${arm64_dirs-${amd64_dirs}}
+tag=${BRANCH:-latest}
image="xtesting"
build_opts=(--pull=true --no-cache --force-rm=true)
-for arch in ${arch};do
+for arch in ${arch}; do
if [[ ${arch} == arm64 ]]; then
find . -name Dockerfile -exec sed -i \
-e "s|alpine:3.12|arm64v8/alpine:3.12|g" {} +
+ find . -name Dockerfile -exec sed -i \
+ -e "s|opnfv/xtesting|${repo}/xtesting:arm64-${tag}|g" {} +
elif [[ ${arch} == arm ]]; then
find . -name Dockerfile -exec sed -i \
-e "s|alpine:3.12|arm32v6/alpine:3.12|g" {} +
+ find . -name Dockerfile -exec sed -i \
+ -e "s|opnfv/xtesting|${repo}/xtesting:arm-${tag}|g" {} +
+ else
+ find . -name Dockerfile -exec sed -i \
+ -e "s|opnfv/xtesting|${repo}/xtesting:amd64-${tag}|g" {} +
fi
- (cd docker && docker build "${build_opts[@]}" \
- -t "${repo}/${image}:${arch}-${tag}" .)
- docker push "${repo}/${image}:${arch}-${tag}"
+ dirs=${arch}_dirs
+ for dir in ${!dirs}; do
+ if [[ ${dir} == docker/core ]]; then
+ image=xtesting
+ else
+ image=xtesting-${dir##**/}
+ fi
+ (cd "${dir}" &&
+ docker build "${build_opts[@]}" \
+ -t "${repo}/${image}:${arch}-${tag}" . &&
+ docker push "${repo}/${image}:${arch}-${tag}")
+ [ "${dir}" != "docker/core" ] &&
+ (docker rmi \
+ "${repo}/${image}:${arch}-${tag}" || true)
+ done
[ "$?" == "0" ] &&
- (sudo docker rmi "${repo}/${image}:${arch}-${tag}"|| true)
+ (sudo docker rmi "${repo}/xtesting:${arch}-${tag}"|| true)
find . -name Dockerfile -exec git checkout \{\} +;
done
exit $?