When building an aarch64 docker image an Dockerfile.aarch64 file is
expected to exist. With this patch we may create it from the x86
Dockerfile by applying an aarch64 patch
This feature can be used with qtip, via
https://gerrit.opnfv.org/gerrit/#/c/30185/
JIRA: ARMBAND-219
Change-Id: I71e1e1852e31f92fb1f1947542f7f397b996541f
Signed-off-by: Cristina Pauna <cristina.pauna@enea.com>
-if [ ! -f ${DOCKERFILE} ]; then
- echo "ERROR: Dockerfile not found."
- exit 1
+HOST_ARCH=$(uname -m)
+if [ ! -f "${DOCKERFILE}" ]; then
+ # If this is expected to be a Dockerfile for other arch than x86
+ # and it does not exist, but there is a patch for the said arch,
+ # then apply the patch and create the Dockerfile.${HOST_ARCH} file
+ if [[ "${DOCKERFILE}" == *"${HOST_ARCH}" && \
+ -f "Dockerfile.${HOST_ARCH}.patch" ]]; then
+ patch -o Dockerfile."${HOST_ARCH}" Dockerfile \
+ Dockerfile."${HOST_ARCH}".patch
+ else
+ echo "ERROR: No Dockerfile or ${HOST_ARCH} patch found."
+ exit 1
+ fi