images: move to use go-licenses

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
This commit is contained in:
Mikko Ylinen 2021-10-13 13:55:45 +03:00
parent 0f82a95563
commit 00633107d7
15 changed files with 15 additions and 70 deletions

View File

@ -31,7 +31,7 @@ COPY . .
RUN cd cmd/operator; GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}"; cd -
RUN install -D /go/bin/operator /install_root/usr/local/bin/intel_deviceplugin_operator \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/operator /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/operator" --save_path /install_root/usr/local/share/go-licenses
FROM gcr.io/distroless/static
COPY --from=builder /install_root /

View File

@ -31,7 +31,7 @@ COPY . .
RUN cd cmd/dlb_plugin; GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}"; cd -
RUN install -D /go/bin/dlb_plugin /install_root/usr/local/bin/intel_dlb_device_plugin \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/dlb_plugin /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/dlb_plugin" --save_path /install_root/usr/local/share/go-licenses
FROM gcr.io/distroless/static
COPY --from=builder /install_root /

View File

@ -31,7 +31,7 @@ COPY . .
RUN cd cmd/dsa_plugin; GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}"; cd -
RUN install -D /go/bin/dsa_plugin /install_root/usr/local/bin/intel_dsa_device_plugin \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/dsa_plugin /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/dsa_plugin" --save_path /install_root/usr/local/share/go-licenses
FROM gcr.io/distroless/static
COPY --from=builder /install_root /

View File

@ -31,7 +31,7 @@ COPY . .
RUN cd cmd/fpga_admissionwebhook; GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}"; cd -
RUN install -D /go/bin/fpga_admissionwebhook /install_root/usr/local/bin/intel_fpga_admissionwebhook \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/fpga_admissionwebhook /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/fpga_admissionwebhook" --save_path /install_root/usr/local/share/go-licenses
FROM gcr.io/distroless/static
COPY --from=builder /install_root /

View File

@ -34,8 +34,8 @@ RUN cd cmd/fpga_crihook && GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "
cd ../fpga_tool && GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}" && \
cd ../.. && \
install -D ${DIR}/LICENSE $ROOT/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE && \
scripts/copy-modules-licenses.sh ./cmd/fpga_crihook $ROOT/usr/local/share/ && \
scripts/copy-modules-licenses.sh ./cmd/fpga_tool $ROOT/usr/local/share/
GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/fpga_crihook" --save_path $ROOT/usr/local/share/go-licenses/fpga_crihook && \
go-licenses save "./cmd/fpga_tool" --save_path $ROOT/usr/local/share/go-licenses/fpga_tool
ARG SRC_DIR=/usr/local/fpga-sw
ARG DST_DIR=/opt/intel/fpga-sw

View File

@ -31,7 +31,7 @@ COPY . .
RUN cd cmd/fpga_plugin; GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}"; cd -
RUN install -D /go/bin/fpga_plugin /install_root/usr/local/bin/intel_fpga_device_plugin \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/fpga_plugin /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/fpga_plugin" --save_path /install_root/usr/local/share/go-licenses
FROM gcr.io/distroless/static
COPY --from=builder /install_root /

View File

@ -34,7 +34,7 @@ ARG ROOT=/install_root
RUN cd cmd/gpu_nfdhook && GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}" && cd -\
install -D ${DIR}/LICENSE $ROOT/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE && \
mkdir -p $ROOT/usr/local/share/ && \
scripts/copy-modules-licenses.sh ./cmd/gpu_nfdhook $ROOT/usr/local/share/
GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/gpu_nfdhook" --save_path $ROOT/usr/local/share/go-licenses
ARG NFD_HOOK=intel-gpu-nfdhook
ARG SRC_DIR=/usr/local/bin/gpu-sw

View File

@ -31,7 +31,7 @@ COPY . .
RUN cd cmd/gpu_plugin; GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}"; cd -
RUN install -D /go/bin/gpu_plugin /install_root/usr/local/bin/intel_gpu_device_plugin \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/gpu_plugin /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/gpu_plugin" --save_path /install_root/usr/local/share/go-licenses
FROM gcr.io/distroless/static
COPY --from=builder /install_root /

View File

@ -43,7 +43,7 @@ RUN cd cmd/qat_plugin; GO111MODULE=${GO111MODULE} CGO_ENABLED=1 go install -tags
RUN chmod a+x /go/bin/qat_plugin \
&& install -D /go/bin/qat_plugin /install_root/usr/local/bin/intel_qat_device_plugin \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/qat_plugin /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/qat_plugin" --save_path /install_root/usr/local/share/go-licenses
FROM debian:unstable-slim
COPY --from=builder /install_root /

View File

@ -31,7 +31,7 @@ COPY . .
RUN cd cmd/qat_plugin; GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}"; cd -
RUN install -D /go/bin/qat_plugin /install_root/usr/local/bin/intel_qat_device_plugin \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/qat_plugin /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/qat_plugin" --save_path /install_root/usr/local/share/go-licenses
FROM gcr.io/distroless/static
COPY --from=builder /install_root /

View File

@ -31,7 +31,7 @@ COPY . .
RUN cd cmd/sgx_admissionwebhook; GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}"; cd -
RUN install -D /go/bin/sgx_admissionwebhook /install_root/usr/local/bin/intel_sgx_admissionwebhook \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/sgx_admissionwebhook /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/sgx_admissionwebhook" --save_path /install_root/usr/local/share/go-licenses
FROM gcr.io/distroless/static
COPY --from=builder /install_root /

View File

@ -34,7 +34,7 @@ ARG ROOT=/install_root
RUN cd cmd/sgx_epchook && GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}" && cd -\
install -D ${DIR}/LICENSE $ROOT/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE && \
mkdir -p $ROOT/usr/local/share/ && \
scripts/copy-modules-licenses.sh ./cmd/sgx_epchook $ROOT/usr/local/share/
GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/sgx_epchook" --save_path $ROOT/usr/local/share/go-licenses
ARG NFD_HOOK=intel-sgx-epchook
ARG SRC_DIR=/usr/local/bin/sgx-sw

View File

@ -31,7 +31,7 @@ COPY . .
RUN cd cmd/sgx_plugin; GO111MODULE=${GO111MODULE} CGO_ENABLED=0 go install "${BUILDFLAGS}"; cd -
RUN install -D /go/bin/sgx_plugin /install_root/usr/local/bin/intel_sgx_device_plugin \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/sgx_plugin /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/sgx_plugin" --save_path /install_root/usr/local/share/go-licenses
FROM gcr.io/distroless/static
COPY --from=builder /install_root /

View File

@ -37,7 +37,7 @@ RUN mkdir -p /install_root/usr/local/share/package-sources/libusb \
RUN cd cmd/vpu_plugin; GO111MODULE=${GO111MODULE} CGO_ENABLED=1 go install "${BUILDFLAGS}"; cd -
RUN install -D /go/bin/vpu_plugin /install_root/usr/local/bin/intel_vpu_device_plugin \
&& install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \
&& scripts/copy-modules-licenses.sh ./cmd/vpu_plugin /install_root/usr/local/share/
&& GO111MODULE=on go install github.com/google/go-licenses@v1.0.0 && go-licenses save "./cmd/vpu_plugin" --save_path /install_root/usr/local/share/go-licenses
FROM debian:unstable-slim
RUN apt update && apt -y install libusb-1.0-0

View File

@ -1,55 +0,0 @@
#!/bin/bash
#
# Copyright 2019-2021 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
#
# Copy the license obligations of ".Deps" modules for a package to a target directory
set -o errexit
set -o nounset
set -o pipefail
if [ $# != 2 ] || [ "$1" = "?" ] || [ "$1" = "--help" ]; then
echo "Usage: $0 <package> <target dir>" >&2
exit 1
fi
if [ ! -d "$2" ] || [ ! -w "$2" ]; then
echo "Error: cannot use $2 as the target directory"
exit 1
fi
if [ ! -d "$2"/package-licenses ]; then
mkdir "$2"/package-licenses
fi
export GO111MODULE=on
if [ ! -d vendor ]; then
go mod vendor -v
fi
LICENSE_FILES=$(find vendor |grep -e LICENSE -e NOTICE|cut -d / -f 2-)
PACKAGE_DEPS=$(go list -f '{{ join .Deps "\n" }}' "$1" |grep "\.")
pushd vendor > /dev/null
for lic in $LICENSE_FILES; do
DIR=$(dirname "$lic")
# Copy the license if its repository path is found in package .Deps
if [ "$(echo "$PACKAGE_DEPS" | grep -c "$DIR")" -gt 0 ]; then
cp -t "$2"/package-licenses --parent "$lic"
# Copy the source if the license is MPL/GPL/LGPL
if [ "$(grep -c -w -e MPL -e GPL -e LGPL "$lic")" -gt 0 ]; then
if [ ! -d "$2"/package-sources ]; then
mkdir "$2"/package-sources
fi
tar -zvcf "$2"/package-sources/"$(echo "$DIR" | tr / _)".tar.gz "$DIR"
fi
fi
done
popd > /dev/null