diff options
author | Vincent Mahe <v.mahe@orange.com> | 2020-05-25 18:32:58 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2020-08-05 13:21:12 +0200 |
commit | 32eb7687bf7b8440aa87805480789ef61ae65ec9 (patch) | |
tree | 82b6e144b87fe694c0d895541d9cac20a983e51c /build.sh | |
parent | 005a5ad5ec6f29e6777ce69cc66524d4cc34517d (diff) |
Add MTS driver
It creates a new container xtesting-mts to avoid increase core
container size.
Signed-off-by: Vincent Mahe <v.mahe@orange.com>
Change-Id: I59544023e1235747e140a442815778a133bf6acf
Diffstat (limited to 'build.sh')
-rw-r--r-- | build.sh | 36 |
1 files changed, 30 insertions, 6 deletions
@@ -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 $? |