# 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 <levente.kale@nokia.com>
+ARG go_version
+FROM golang:${go_version}-alpine3.9 as builder
+MAINTAINER Ferenc Toth <ferenc.2.toth@nokia.com>
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"]
+++ /dev/null
-{
- "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"
- }
- ]
-}