From c1d22f98f6ce7e49faf1443ae904bad48fb9e79b Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Thu, 24 May 2018 14:53:19 +0100 Subject: [PATCH] rootfs: Default to host architecture Don't default to a hard-coded Intel architecture - default to the host architecture. This requires the `coreutils` package to be installed both inside each docker image (for `USE_DOCKER=true`) and in the host environments. Added missing SPDX headers to `Dockerfile` templates to pacify the CI checks. Fixes #100. Signed-off-by: James O. D. Hunt --- .ci/setup.sh | 4 ++-- rootfs-builder/alpine/Dockerfile.in | 9 ++++++++- rootfs-builder/centos/Dockerfile.in | 7 ++++++- rootfs-builder/clearlinux/Dockerfile.in | 7 ++++++- rootfs-builder/euleros/Dockerfile.in | 8 +++++++- rootfs-builder/fedora/Dockerfile.in | 7 ++++++- rootfs-builder/rootfs.sh | 2 +- rootfs-builder/template/Dockerfile.template | 5 +++++ 8 files changed, 41 insertions(+), 8 deletions(-) diff --git a/.ci/setup.sh b/.ci/setup.sh index c5f966886a..ca66fc1033 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -14,12 +14,12 @@ bash "${cidir}/static-checks.sh" source /etc/os-release if [ "$ID" == fedora ];then - sudo -E dnf -y install automake bats yamllint + sudo -E dnf -y install automake bats yamllint coreutils elif [ "$ID" == ubuntu ];then #bats isn't available for Ubuntu trusty, need for travis sudo add-apt-repository -y ppa:duggan/bats sudo apt-get -qq update - sudo apt-get install -y -qq automake bats qemu-utils python-pip + sudo apt-get install -y -qq automake bats qemu-utils python-pip coreutils sudo pip install yamllint else echo "Linux distribution not supported" diff --git a/rootfs-builder/alpine/Dockerfile.in b/rootfs-builder/alpine/Dockerfile.in index 538f84b618..19254b2100 100644 --- a/rootfs-builder/alpine/Dockerfile.in +++ b/rootfs-builder/alpine/Dockerfile.in @@ -1,3 +1,10 @@ +# +# Copyright (c) 2018 HyperHQ Inc. +# +# SPDX-License-Identifier: Apache-2.0 + From golang:@GO_VERSION@-alpine3.7 -RUN apk update && apk add git make bash gcc musl-dev linux-headers apk-tools-static +# The "coreutils" package on alpine for reasons unknown does not provide arch(1), so simulate it. +RUN apk update && apk add git make bash gcc musl-dev linux-headers apk-tools-static && \ + echo -e '#!/bin/sh\nuname -m' > /usr/bin/arch && chmod +x /usr/bin/arch diff --git a/rootfs-builder/centos/Dockerfile.in b/rootfs-builder/centos/Dockerfile.in index d16466d466..4a93e322d7 100644 --- a/rootfs-builder/centos/Dockerfile.in +++ b/rootfs-builder/centos/Dockerfile.in @@ -1,6 +1,11 @@ +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + From centos:@OS_VERSION@ -RUN yum -y update && yum install -y git make gcc +RUN yum -y update && yum install -y git make gcc coreutils # This will install the proper golang to build Kata components @INSTALL_GO@ diff --git a/rootfs-builder/clearlinux/Dockerfile.in b/rootfs-builder/clearlinux/Dockerfile.in index 69c0b2badd..4e38d364a1 100644 --- a/rootfs-builder/clearlinux/Dockerfile.in +++ b/rootfs-builder/clearlinux/Dockerfile.in @@ -1,6 +1,11 @@ +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + From fedora:27 -RUN dnf -y update && dnf install -y git systemd pkgconfig gcc +RUN dnf -y update && dnf install -y git systemd pkgconfig gcc coreutils # This will install the proper golang to build Kata components @INSTALL_GO@ diff --git a/rootfs-builder/euleros/Dockerfile.in b/rootfs-builder/euleros/Dockerfile.in index 5378c65947..97cae78db0 100644 --- a/rootfs-builder/euleros/Dockerfile.in +++ b/rootfs-builder/euleros/Dockerfile.in @@ -1,5 +1,11 @@ +# +# Copyright (C) 2018 Huawei Technologies Co., Ltd +# +# SPDX-License-Identifier: Apache-2.0 + FROM euleros:@OS_VERSION@ -RUN yum -y update && yum install -y yum git make gcc +RUN yum -y update && yum install -y yum git make gcc coreutils + # This will install the proper golang to build Kata components @INSTALL_GO@ diff --git a/rootfs-builder/fedora/Dockerfile.in b/rootfs-builder/fedora/Dockerfile.in index f98f36117d..39fadc1a08 100644 --- a/rootfs-builder/fedora/Dockerfile.in +++ b/rootfs-builder/fedora/Dockerfile.in @@ -1,6 +1,11 @@ +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + From fedora:@OS_VERSION@ -RUN dnf -y update && dnf install -y git redhat-release systemd pkgconfig gcc +RUN dnf -y update && dnf install -y git redhat-release systemd pkgconfig gcc coreutils # This will install the proper golang to build Kata components @INSTALL_GO@ diff --git a/rootfs-builder/rootfs.sh b/rootfs-builder/rootfs.sh index 13b846fbf4..be0fc7a73d 100755 --- a/rootfs-builder/rootfs.sh +++ b/rootfs-builder/rootfs.sh @@ -20,7 +20,7 @@ lib_file="${script_dir}/../scripts/lib.sh" source "$lib_file" # Default architecture -ARCH=${ARCH:-"x86_64"} +ARCH=$(arch) # Load default versions for golang and other componets source "${script_dir}/versions.txt" diff --git a/rootfs-builder/template/Dockerfile.template b/rootfs-builder/template/Dockerfile.template index 87c9b9fdaf..95a07deec3 100644 --- a/rootfs-builder/template/Dockerfile.template +++ b/rootfs-builder/template/Dockerfile.template @@ -1,3 +1,8 @@ +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + #@distro@: docker image to be used to create a rootfs #@OS_VERSION@: Docker image version to build this dockerfile from @distro@:@OS_VERSION@