Add aarch64 support 91/2191/4
authorAlexandru Antone <Alexandru.Antone@enea.com>
Tue, 14 Jan 2020 14:28:15 +0000 (16:28 +0200)
committerAlexandru Antone <Alexandru.Antone@enea.com>
Thu, 16 Jan 2020 09:19:07 +0000 (11:19 +0200)
Also unify docker build at rpm install time.

Signed-off-by: Alexandru Antone <Alexandru.Antone@enea.com>
Change-Id: I16c13de36445e1d0c4a46a4015c2af06aca0e500

docker-build/remote-installer/Dockerfile
remote-installer.spec
scripts/build.sh

index 3c54056..e5ff569 100644 (file)
@@ -12,7 +12,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM centos:7.6.1810
+ARG BASEIMAGE_TAG
+
+FROM "${BASEIMAGE_TAG}"
 MAINTAINER Ralf Mueller <ralf.1.mueller@nokia.com>
 
 ENV \
 MAINTAINER Ralf Mueller <ralf.1.mueller@nokia.com>
 
 ENV \
index b57991e..f921026 100644 (file)
 
 Name:           remote-installer
 Version:        %{_version}
 
 Name:           remote-installer
 Version:        %{_version}
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Contains components for the remote-installer
 Group:          %{_platform_group}
 License:        %{_platform_licence}
 Source0:        %{name}-%{version}.tar.gz
 Vendor:         %{_platform_vendor}
 Summary:        Contains components for the remote-installer
 Group:          %{_platform_group}
 License:        %{_platform_licence}
 Source0:        %{name}-%{version}.tar.gz
 Vendor:         %{_platform_vendor}
-
-BuildArch:      noarch
+BuildArch:      %{_arch}
 
 # BuildRequires:  docker
 
 
 # BuildRequires:  docker
 
@@ -31,18 +30,14 @@ Contains components for the remote-installer
 %prep
 
 %build
 %prep
 
 %build
-docker build \
-  --network=host \
-  --no-cache \
-  --force-rm \
-  --build-arg HTTP_PROXY="${http_proxy}" \
-  --build-arg HTTPS_PROXY="${https_proxy}" \
-  --build-arg NO_PROXY="${no_proxy}" \
-  --build-arg http_proxy="${http_proxy}" \
-  --build-arg https_proxy="${https_proxy}" \
-  --build-arg no_proxy="${no_proxy}" \
-  --tag remote-installer \
-  --file docker-build/remote-installer/Dockerfile .
+BASEIMAGE_TAG='centos:7.6.1810'
+
+# For aarch64 use the closest available upstream version
+if [ "%{_arch}" = "aarch64" ]; then
+    BASEIMAGE_TAG='centos@sha256:df89b0a0b42916b5b31b334fd52d3e396c226ad97dfe772848bdd6b00fb42bf0'
+fi
+
+scripts/build.sh -t "${BASEIMAGE_TAG}"
 
 # Here hould be some registry but it should be handled by a Jenkis job
 docker image save remote-installer >remote-installer-image.tar
 
 # Here hould be some registry but it should be handled by a Jenkis job
 docker image save remote-installer >remote-installer-image.tar
index a73cb9f..ee9d89d 100755 (executable)
 cd "$(dirname "$0")"/..
 
 TAR_IMAGE="remote-installer.tar"
 cd "$(dirname "$0")"/..
 
 TAR_IMAGE="remote-installer.tar"
+DOCKERFILE='docker-build/remote-installer/Dockerfile'
 
 help()
 {
 
 help()
 {
-       echo -e "$(basename $0) [-hs]"
-       echo -e "   -h  display this help"
-       echo -e "   -s  save image as tar to $TAR_IMAGE"
+    echo -e "$(basename "$0") [-hs] -t <tag>"
+    echo -e "   -h        display this help"
+    echo -e "   -s        save image as tar to $TAR_IMAGE"
+    echo -e "   -t <tag>  specify docker base image tag"
     echo
     echo -e "Proxy configuration is taken from environment variables"
     echo -e "http_proxy, https_proxy and no_proxy"
 }
 
     echo
     echo -e "Proxy configuration is taken from environment variables"
     echo -e "http_proxy, https_proxy and no_proxy"
 }
 
-while getopts "hs" arg; do
+while getopts "hst:" arg; do
     case $arg in
         h)
             help
     case $arg in
         h)
             help
-                       exit 0
+            exit 0
             ;;
         s)
             ;;
         s)
-                   SAVE_IMAGE="yes"
+            SAVE_IMAGE="yes"
+            ;;
+        t)
+            BASEIMAGE_TAG="$OPTARG"
             ;;
   esac
 done
 
 docker build \
             ;;
   esac
 done
 
 docker build \
+  --network=host \
   --no-cache \
   --force-rm \
   --no-cache \
   --force-rm \
+  --build-arg BASEIMAGE_TAG="${BASEIMAGE_TAG}" \
   --build-arg HTTP_PROXY="${http_proxy}" \
   --build-arg HTTPS_PROXY="${https_proxy}" \
   --build-arg NO_PROXY="${no_proxy}" \
   --build-arg HTTP_PROXY="${http_proxy}" \
   --build-arg HTTPS_PROXY="${https_proxy}" \
   --build-arg NO_PROXY="${no_proxy}" \
@@ -49,7 +56,7 @@ docker build \
   --build-arg https_proxy="${https_proxy}" \
   --build-arg no_proxy="${no_proxy}" \
   --tag remote-installer \
   --build-arg https_proxy="${https_proxy}" \
   --build-arg no_proxy="${no_proxy}" \
   --tag remote-installer \
-  --file docker-build/remote-installer/Dockerfile .
+  --file "${DOCKERFILE}" .
 
 
 # could be compressed but it's only used until there is an registry
 
 
 # could be compressed but it's only used until there is an registry