From a7fdbdf37816d2beced1bbe1cd6f2b24c207980f Mon Sep 17 00:00:00 2001 From: bborbely Date: Tue, 24 Sep 2019 14:51:23 +0200 Subject: [PATCH] Update SRIOVDP to 3.0.0+ version MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - Due to a bug in v3.0.0 release, we need to use a fresh commit hash: a015e56ae715e2b6dae15e42827e4e8f43eeceac - SRIOVDP Dockerfile has been rewritten to use builder container method to create smaller image. - Go source building is eliminated to speed up the building process. Change-Id: Ia31bcd757394f224aa3d71acd6649c9a07b52171 Signed-off-by: Ferenc Tóth --- SPECS/caas-sriovdp.spec | 6 +- docker-build/sriovdp/Dockerfile | 54 +++++----- docker-build/sriovdp/bom.json | 214 ---------------------------------------- 3 files changed, 26 insertions(+), 248 deletions(-) delete mode 100644 docker-build/sriovdp/bom.json diff --git a/SPECS/caas-sriovdp.spec b/SPECS/caas-sriovdp.spec index 62b3151..9e145ed 100644 --- a/SPECS/caas-sriovdp.spec +++ b/SPECS/caas-sriovdp.spec @@ -14,10 +14,11 @@ %define COMPONENT sriovdp %define RPM_NAME caas-%{COMPONENT} -%define RPM_MAJOR_VERSION 2.0.0 -%define RPM_MINOR_VERSION 5 +%define RPM_MAJOR_VERSION 3.0.0 +%define RPM_MINOR_VERSION 0 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION} %define go_version 1.12.9 +%define SRIOVDP_HASH a015e56ae715e2b6dae15e42827e4e8f43eeceac Name: %{RPM_NAME} Version: %{RPM_MAJOR_VERSION} @@ -50,6 +51,7 @@ docker build \ --build-arg https_proxy="${https_proxy}" \ --build-arg no_proxy="${no_proxy}" \ --build-arg SRIOVDP="%{RPM_MAJOR_VERSION}" \ + --build-arg SRIOVDP_HASH="%{SRIOVDP_HASH}" \ --build-arg go_version="%{go_version}" \ --tag %{COMPONENT}:%{IMAGE_TAG} \ %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-build/%{COMPONENT}/ diff --git a/docker-build/sriovdp/Dockerfile b/docker-build/sriovdp/Dockerfile index 554c389..65a54a6 100644 --- a/docker-build/sriovdp/Dockerfile +++ b/docker-build/sriovdp/Dockerfile @@ -1,52 +1,42 @@ # Copyright 2019 Nokia -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -FROM alpine:3.9 -MAINTAINER Levente Kale +ARG go_version +FROM golang:${go_version}-alpine3.9 as builder +MAINTAINER Ferenc Toth ARG SRIOVDP -ENV SRIOVDP_VERSION=$SRIOVDP -ENV GOPATH /go -ARG go_install_dir="/usr/local/go" -ARG go_version -ENV PATH $GOPATH/bin:$go_install_dir/bin:/usr/local/go/bin:$PATH -ENV GOOS=linux +ARG SRIOVDP_HASH="" -WORKDIR / +RUN apk add --no-cache gcc musl-dev git curl tar linux-headers \ +&& mkdir -p $GOPATH/src/github.com/intel/sriov-network-device-plugin \ +&& cd $GOPATH/src/github.com/intel \ +&& if [ -n "$SRIOVDP_HASH" ]; then \ + git clone https://github.com/intel/sriov-network-device-plugin.git \ +&& cd sriov-network-device-plugin \ +&& git checkout $SRIOVDP_HASH; \ + else \ + curl -fsSL https://github.com/intel/sriov-network-device-plugin/archive/v${SRIOVDP}.tar.gz | tar xz --strip-components=1 -C sriov-network-device-plugin; \ + fi \ +&& go install -a -ldflags '-extldflags "-static"' github.com/intel/sriov-network-device-plugin/cmd/sriovdp -RUN apk add --no-cache jq \ -&& apk add --no-cache --virtual .tools ca-certificates gcc musl-dev go glide git bash curl tar \ -&& mkdir -p $go_install_dir \ -&& curl -fsSL -k https://dl.google.com/go/go${go_version}.src.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \ -&& cd ${go_install_dir}/src/ \ -&& ./make.bash \ -&& mkdir -p $GOPATH/src/github.com/intel \ -&& git clone https://github.com/intel/sriov-network-device-plugin.git $GOPATH/src/github.com/intel/sriov-network-device-plugin --branch=v${SRIOVDP_VERSION} \ -&& cd $GOPATH/src/github.com/intel/sriov-network-device-plugin \ -&& glide --quiet install -v \ -&& go install -a -ldflags '-extldflags "-static"' github.com/intel/sriov-network-device-plugin/cmd/sriovdp \ -&& cp $GOPATH/bin/sriovdp /usr/local/bin/sriovdp \ -&& rm -rf $GOPATH/src \ -&& rm -rf $GOPATH/bin \ -&& apk del .tools \ -&& rm -rf $go_install_dir \ -&& rm -rf /var/cache/apk/* \ -&& rm -rf /var/lib/apt/lists/* \ -&& rm -rf /tmp/* \ -&& rm -rf ~/.glide +FROM alpine:3.9 +RUN apk add --no-cache hwdata-pci jq +COPY --from=builder /go/bin/sriovdp /usr/local/bin/ RUN chmod 700 /usr/local/bin/sriovdp +WORKDIR / LABEL io.k8s.display-name="SRIOV Network Device Plugin" ENTRYPOINT ["/usr/local/bin/sriovdp"] diff --git a/docker-build/sriovdp/bom.json b/docker-build/sriovdp/bom.json deleted file mode 100644 index 37f0a95..0000000 --- a/docker-build/sriovdp/bom.json +++ /dev/null @@ -1,214 +0,0 @@ -{ - "bom": [ - { - "name": "alpine-linux-container", - "version": "3.9", - "source-url": "https://github.com/gliderlabs/docker-alpine/archive/c4f4c7a6e14d6efeb9a160da464717e03d2cc3ee.tar.gz", - "foss": "yes" - }, - { - "name": "musl", - "version": "1.1.20-r3", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/musl/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "busybox", - "version": "1.29.3-r10", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/busybox/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "alpine-baselayout", - "version": "3.1.0-r3", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/alpine-baselayout/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "alpine-keys", - "version": "2.1-r1", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/alpine-keys/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "libcrypto1.1", - "version": "1.1.1a-r1", - "source-url": "https://git.alpinelinux.org/aports/tree/main/openssl/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "libssl1.1", - "version": "1.1.1a-r1", - "source-url": "https://git.alpinelinux.org/aports/tree/main/openssl/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "ca-certificates-cacert", - "version": "20190108-r0", - "source-url": "https://git.alpinelinux.org/aports/tree/main/ca-certificates/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "libtls-standalone", - "version": "2.7.4-r6", - "source-url": "https://git.alpinelinux.org/aports/tree/main/libtls-standalone/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "ssl_client", - "version": "1.29.3-r10", - "source-url": "https://git.alpinelinux.org/aports/tree/main/busybox/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "zlib", - "version": "1.2.11-r1", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/zlib/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "apk-tools", - "version": "2.10.3-r1", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/apk-tools/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "scanelf", - "version": "1.2.3-r0", - "source-url": "https://git.alpinelinux.org/aports/tree/main/pax-utils/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "musl-utils", - "version": "1.1.20-r3", - "source-url": "https://git.alpinelinux.org/aports/tree/main/musl/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "libc-utils", - "version": "0.7.1-r0", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/libc-dev/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "libbz2", - "version": "1.0.6-r6", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/bzip2/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "expat", - "version": "2.2.6-r0", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/expat/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "libffi", - "version": "3.2.1-r6", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/libffi/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "gdbm", - "version": "1.13-r1", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/gdbm/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "ncurses-terminfo-base", - "version": "6.1_p20190105-r0", - "source-url": "https://git.alpinelinux.org/aports/tree/main/ncurses/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "ncurses-terminfo", - "version": "6.1_p20190105-r0", - "source-url": "https://git.alpinelinux.org/aports/tree/main/ncurses/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "ncurses-libs", - "version": "6.1_p20190105-r0", - "source-url": "https://git.alpinelinux.org/aports/tree/main/ncurses/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "readline", - "version": "7.0.003-r1", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/readline/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "sqlite-libs", - "version": "3.26.0-r3", - "source-url": "https://git.alpinelinux.org/aports/tree/main/sqlite/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "python2", - "version": "2.7.15-r3", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/python2/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "py-setuptools", - "version": "40.6.3-r0", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/py-setuptools/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "py2-pip", - "version": "18.1-r0", - "source-url": "https://git.alpinelinux.org/cgit/aports/tree/main/py2-pip/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "ca-certificates", - "version": "20190108-r0", - "source-url": "https://git.alpinelinux.org/aports/tree/main/ca-certificates/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "nghttp2-libs", - "version": "1.35.1-r0", - "source-url": "https://git.alpinelinux.org/aports/tree/main/nghttp2/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "libssh2", - "version": "1.8.0-r4", - "source-url": "https://git.alpinelinux.org/aports/tree/main/libssh2/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "libcurl", - "version": "7.63.0-r0", - "source-url": "https://git.alpinelinux.org/aports/tree/main/curl/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "curl", - "version": "7.63.0-r0", - "source-url": "https://git.alpinelinux.org/aports/tree/main/curl/APKBUILD?h=3.9-stable", - "foss": "yes" - }, - { - "name": "pip", - "version": "19.0.2", - "source-url": "https://github.com/pypa/pip/archive/19.0.2.tar.gz", - "foss": "yes" - }, - { - "name": "setuptools", - "version": "40.6.3.post20190116", - "source-url": "https://github.com/pypa/setuptools/archive/v40.6.3.tar.gz", - "foss": "yes" - }, - { - "name": "sriovdp", - "version": "2.0.0", - "source-url": "https://github.com/intel/sriov-network-device-plugin/archive/v2.0.0.tar.gz", - "foss": "yes" - } - ] -} -- 2.16.6