|
1 | | -# CLEAR_LINUX_BASE and CLEAR_LINUX_VERSION can be used to make the build |
2 | | -# reproducible by choosing an image by its hash and installing an OS version |
3 | | -# with --version=: |
4 | | -# CLEAR_LINUX_BASE=clearlinux@sha256:b8e5d3b2576eb6d868f8d52e401f678c873264d349e469637f98ee2adf7b33d4 |
5 | | -# CLEAR_LINUX_VERSION="--version=29970" |
| 1 | +# Copyright 2021 Intel Corporation. All Rights Reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# GOLANG_BASE can be used to make the build reproducible by choosing an |
| 16 | +# image by its hash: |
| 17 | +# GOLANG_BASE=golang@sha256:9d64369fd3c633df71d7465d67d43f63bb31192193e671742fa1c26ebc3a6210 |
6 | 18 | # |
7 | 19 | # This is used on release branches before tagging a stable version. |
8 | | -# The master branch defaults to using the latest Clear Linux. |
9 | | -ARG CLEAR_LINUX_BASE=clearlinux/golang:latest |
| 20 | +# The main branch defaults to using the latest Golang base image. |
| 21 | +ARG GOLANG_BASE=golang:1.16-buster |
10 | 22 |
|
11 | | -FROM ${CLEAR_LINUX_BASE} as builder |
| 23 | +FROM ${GOLANG_BASE} as builder |
12 | 24 |
|
13 | | -ARG CLEAR_LINUX_VERSION= |
14 | | - |
15 | | -RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION} |
16 | | -RUN ldconfig |
17 | 25 | ARG DIR=/intel-device-plugins-for-kubernetes |
18 | 26 | ARG GO111MODULE=on |
| 27 | +ARG BUILDFLAGS="-ldflags=-w -s" |
19 | 28 | WORKDIR $DIR |
20 | 29 | COPY . . |
21 | 30 |
|
22 | | -ARG TAGS_KERNELDRV=kerneldrv |
23 | | - |
24 | | -RUN mkdir /install_root \ |
25 | | - && swupd os-install \ |
26 | | - ${CLEAR_LINUX_VERSION} \ |
27 | | - --path /install_root \ |
28 | | - --statedir /swupd-state \ |
29 | | - $(test -z "${TAGS_KERNELDRV}" || echo "--bundles=libstdcpp") \ |
30 | | - --no-boot-update \ |
31 | | - && rm -rf /install_root/var/lib/swupd/* |
32 | | - |
33 | 31 | ARG QAT_DRIVER_RELEASE="qat1.7.l.4.11.0-00001" |
34 | 32 |
|
35 | | -RUN test -z "${TAGS_KERNELDRV}" \ |
36 | | - || ( swupd bundle-add wget c-basic \ |
37 | | - && mkdir -p /usr/src/qat \ |
| 33 | +RUN mkdir -p /usr/src/qat \ |
38 | 34 | && cd /usr/src/qat \ |
39 | 35 | && wget https://01.org/sites/default/files/downloads/${QAT_DRIVER_RELEASE}.tar.gz \ |
40 | 36 | && tar xf *.tar.gz \ |
41 | 37 | && cd /usr/src/qat/quickassist/utilities/adf_ctl \ |
42 | 38 | && make KERNEL_SOURCE_DIR=/usr/src/qat/quickassist/qat \ |
43 | | - && install -D adf_ctl /install_root/usr/local/bin/adf_ctl ) |
44 | | -RUN cd cmd/qat_plugin; echo "build tags: ${TAGS_KERNELDRV}"; GO111MODULE=${GO111MODULE} go install -tags "${TAGS_KERNELDRV}"; cd - |
| 39 | + && install -D adf_ctl /install_root/usr/local/bin/adf_ctl |
| 40 | +RUN cd cmd/qat_plugin; GO111MODULE=${GO111MODULE} CGO_ENABLED=1 go install -tags kerneldrv; cd - |
45 | 41 | RUN chmod a+x /go/bin/qat_plugin \ |
46 | 42 | && install -D /go/bin/qat_plugin /install_root/usr/local/bin/intel_qat_device_plugin \ |
47 | 43 | && install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE \ |
48 | 44 | && scripts/copy-modules-licenses.sh ./cmd/qat_plugin /install_root/usr/local/share/ |
49 | 45 |
|
50 | | -FROM scratch as final |
| 46 | +FROM debian:buster-slim |
51 | 47 | COPY --from=builder /install_root / |
52 | 48 | ENV PATH=/usr/local/bin |
53 | 49 | ENTRYPOINT ["/usr/local/bin/intel_qat_device_plugin"] |
0 commit comments