mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00

Also install the igc-core components as they seem to be required. Sadly the container size will increase with little benefit. Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>
97 lines
4.9 KiB
Docker
97 lines
4.9 KiB
Docker
#define _ENTRYPOINT_ /usr/local/bin/intel_gpu_levelzero
|
|
|
|
ARG CMD=gpu_levelzero
|
|
ARG ROCKYLINUX=1
|
|
|
|
## FINAL_BASE_DYN can be used to configure the base image of the final image.
|
|
## The project default is 1) which sets FINAL_BASE_DYN=gcr.io/distroless/cc-debian12
|
|
## (see build-image.sh).
|
|
## 2) and the default FINAL_BASE is primarily used to build Redhat Certified Openshift Operator container images that must be UBI based.
|
|
## The RedHat build tool does not allow additional image build parameters.
|
|
ARG BUILD_BASE=rockylinux:9
|
|
ARG FINAL_BASE_DYN=registry.access.redhat.com/ubi9/ubi-minimal:9.3
|
|
###
|
|
|
|
## Use the BUILD_BASE when either the a) golang-bookworm is updated to a newer glibc
|
|
## or b) the intel-igc-core libraries are fixed to not to demand a newer glibc
|
|
FROM ${FINAL_BASE_DYN} AS builder
|
|
|
|
ARG DIR=/intel-device-plugins-for-kubernetes
|
|
|
|
ENV CGO_CFLAGS="-pipe -fno-plt"
|
|
ENV CGO_LDFLAGS="-fstack-protector-strong -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now,-z,noexecstack,-z,defs,-s,-w"
|
|
ENV CGOFLAGS="-trimpath -mod=readonly -buildmode=pie"
|
|
ENV GCFLAGS="all=-spectre=all -N -l"
|
|
ENV ASMFLAGS="all=-spectre=all"
|
|
ENV LDFLAGS="all=-linkmode=external -s -w"
|
|
|
|
ARG GOLICENSES_VERSION
|
|
ARG CMD
|
|
ARG ROCKYLINUX
|
|
ARG CGO_VERSION=1.24
|
|
|
|
RUN mkdir /runtime
|
|
|
|
RUN if [ $ROCKYLINUX -eq 0 ]; then \N
|
|
apt-get update && apt-get install --no-install-recommends -y wget jq curl libc6-dev ocl-icd-libopencl1 gcc ca-certificates && \N
|
|
LATEST_GO=$(curl --no-progress-meter https://go.dev/dl/?mode=json | jq ".[] | select(.version | startswith(\"go${CGO_VERSION}\")).version" | tr -d "\"") && \N
|
|
wget -q https://go.dev/dl/$LATEST_GO.linux-amd64.tar.gz -O - | tar -xz -C /usr/local && \N
|
|
cd /runtime && \N
|
|
wget -q https://github.com/intel/compute-runtime/releases/download/25.09.32961.7/intel-level-zero-gpu_1.6.32961.7_amd64.deb && \N
|
|
wget -q https://github.com/intel/compute-runtime/releases/download/25.09.32961.7/intel-opencl-icd_25.09.32961.7_amd64.deb && \N
|
|
wget -q https://github.com/intel/compute-runtime/releases/download/25.09.32961.7/libigdgmm12_22.6.0_amd64.deb && \N
|
|
wget -q https://github.com/oneapi-src/level-zero/releases/download/v1.20.2/level-zero-devel_1.20.2+u22.04_amd64.deb && \N
|
|
wget -q https://github.com/oneapi-src/level-zero/releases/download/v1.20.2/level-zero_1.20.2+u22.04_amd64.deb && \N
|
|
wget -q https://github.com/intel/intel-graphics-compiler/releases/download/v2.8.3/intel-igc-core-2_2.8.3+18762_amd64.deb && \N
|
|
wget -q https://github.com/intel/intel-graphics-compiler/releases/download/v2.8.3/intel-igc-opencl-2_2.8.3+18762_amd64.deb && \N
|
|
dpkg -i *.deb && \N
|
|
rm -rf /var/lib/apt/lists/\*; \N
|
|
else \N
|
|
source /etc/os-release && dnf install -y gcc jq wget 'dnf-command(config-manager)' && \N
|
|
dnf config-manager --add-repo https://repositories.intel.com/gpu/rhel/${VERSION_ID}/lts/2350/unified/intel-gpu-${VERSION_ID}.repo && \N
|
|
dnf install -y intel-opencl level-zero level-zero-devel intel-level-zero-gpu intel-gmmlib intel-ocloc && \N
|
|
dnf clean all && \N
|
|
LATEST_GO=$(curl --no-progress-meter https://go.dev/dl/?mode=json | jq ".[] | select(.version | startswith(\"go${CGO_VERSION}\")).version" | tr -d "\"") && \N
|
|
wget -q https://go.dev/dl/$LATEST_GO.linux-amd64.tar.gz -O - | tar -xz -C /usr/local && \N
|
|
cp -a /etc/OpenCL /usr/lib64/libocloc.so /usr/lib64/libze_intel_gpu.* /usr/lib64/libze_loader.* /usr/lib64/libigdgmm.* /runtime/ && \N
|
|
mkdir /runtime/licenses/ && cd /usr/share/licenses/ && cp -a level-zero intel-gmmlib intel-level-zero-gpu intel-ocloc /runtime/licenses/; \N
|
|
fi
|
|
|
|
ARG EP=_ENTRYPOINT_
|
|
ARG CMD
|
|
|
|
WORKDIR ${DIR}
|
|
COPY . .
|
|
|
|
## Apply for the build phase as well as the license copy below the build.
|
|
ENV PATH=$PATH:/usr/local/go/bin/
|
|
|
|
RUN cd cmd/${CMD} && \N
|
|
GO111MODULE=on CGO_ENABLED=1 go install $CGOFLAGS --gcflags="$GCFLAGS" --asmflags="$ASMFLAGS" --ldflags="$LDFLAGS"
|
|
RUN [ $ROCKYLINUX -eq 0 ] && install -D /go/bin/${CMD} /install_root${EP} || install -D /root/go/bin/${CMD} /install_root${EP}
|
|
|
|
#include "default_licenses.docker"
|
|
|
|
FROM ${FINAL_BASE_DYN}
|
|
|
|
ARG CMD
|
|
ARG ROCKYLINUX
|
|
|
|
COPY --from=builder /runtime /runtime
|
|
|
|
RUN if [ $ROCKYLINUX -eq 0 ]; then \N
|
|
apt-get update && apt-get install --no-install-recommends -y ocl-icd-libopencl1 && \N
|
|
rm /runtime/level-zero-devel_*.deb && \N
|
|
cd /runtime && dpkg -i *.deb && rm -rf /runtime && \N
|
|
rm "/lib/x86_64-linux-gnu/libze_validation"* && rm "/lib/x86_64-linux-gnu/libze_tracing_layer"*; \N
|
|
else \N
|
|
cp -a /runtime//*.so* /usr/lib64/ && cp -a /runtime/OpenCL /etc/ && cp -a /runtime/licenses/* /usr/share/licenses/; \N
|
|
fi
|
|
|
|
#include "default_end.docker"
|
|
#include "default_labels.docker"
|
|
|
|
LABEL name='intel-gpu-levelzero'
|
|
LABEL summary='Intel® GPU levelzero for Kubernetes'
|
|
LABEL description='The GPU levelzero container provides access to Levelzero API for the Intel GPU plugin'
|