Allow building aarch64 images
[functest.git] / build.sh
1 #!/bin/bash
2
3 set -e
4
5 repo=${repo:-opnfv}
6 x86_64_dirs=${x86_64_dirs-"\
7 docker/core \
8 docker/healthcheck \
9 docker/smoke \
10 docker/features \
11 docker/components \
12 docker/vnf \
13 docker/parser \
14 docker/restapi"}
15 aarch64_dirs=${aarch64_dirs-$(echo "${x86_64_dirs}" | sed -e "s|docker/vnf||" \
16     -e "s|docker/restapi||")}
17
18 find . -name Dockerfile -exec sed -i -e "s|opnfv/functest-core|${repo}/functest-core:x86_64-latest|g" {} +
19 for dir in ${x86_64_dirs}; do
20     (cd "${dir}" && docker build -t "${repo}/functest-${dir##**/}:x86_64-latest" .)
21     docker push "${repo}/functest-${dir##**/}:x86_64-latest"
22 done
23 find . -name Dockerfile -exec git checkout {} +
24
25 find . -name Dockerfile -exec sed -i -e "s|alpine:3.6|multiarch/alpine:aarch64-v3.6|g" {} +
26 find . -name Dockerfile -exec sed -i -e "s|opnfv/functest-core|${repo}/functest-core:aarch64-latest|g" {} +
27 for dir in ${aarch64_dirs}; do
28     (cd "${dir}" && docker build -t "${repo}/functest-${dir##**/}:aarch64-latest" .)
29     docker push "${repo}/functest-${dir##**/}:aarch64-latest"
30 done
31 find . -name Dockerfile -exec git checkout {} +
32
33 exit $?