Update the base image of inference-cpp image to oneapi 2025.0.2 (#12802)

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile
This commit is contained in:
Shaojun Liu 2025-02-12 14:15:08 +08:00 committed by GitHub
parent 73cfe293fa
commit bd815a4d96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,71 +1,85 @@
FROM intel/oneapi-basekit:2024.2.1-0-devel-ubuntu22.04 FROM intel/oneapi-basekit:2025.0.2-0-devel-ubuntu22.04
# Set build arguments for proxy
ARG http_proxy ARG http_proxy
ARG https_proxy ARG https_proxy
ENV TZ=Asia/Shanghai # Set environment variables
ENV PYTHONUNBUFFERED=1 ENV TZ=Asia/Shanghai \
PYTHONUNBUFFERED=1 \
SYCL_CACHE_PERSISTENT=1
# When cache is enabled SYCL runtime will try to cache and reuse JIT-compiled binaries. # Disable pip cache
ENV SYCL_CACHE_PERSISTENT=1
# Disable pip's cache behavior
ARG PIP_NO_CACHE_DIR=false ARG PIP_NO_CACHE_DIR=false
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/intel-oneapi-archive-keyring.gpg > /dev/null && \ # Install dependencies and configure the environment
RUN set -eux && \
\
# Configure Intel OneAPI and GPU repositories
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/intel-oneapi-archive-keyring.gpg > /dev/null && \
echo "deb [signed-by=/usr/share/keyrings/intel-oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && \ echo "deb [signed-by=/usr/share/keyrings/intel-oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && \
chmod 644 /usr/share/keyrings/intel-oneapi-archive-keyring.gpg && \ chmod 644 /usr/share/keyrings/intel-oneapi-archive-keyring.gpg && \
rm /etc/apt/sources.list.d/intel-graphics.list && \ rm /etc/apt/sources.list.d/intel-graphics.list && \
wget -O- https://repositories.intel.com/graphics/intel-graphics.key | gpg --dearmor | tee /usr/share/keyrings/intel-graphics.gpg > /dev/null && \ wget -O- https://repositories.intel.com/graphics/intel-graphics.key | gpg --dearmor | tee /usr/share/keyrings/intel-graphics.gpg > /dev/null && \
echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy arc" | tee /etc/apt/sources.list.d/intel.gpu.jammy.list && \ echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy arc" | tee /etc/apt/sources.list.d/intel.gpu.jammy.list && \
chmod 644 /usr/share/keyrings/intel-graphics.gpg && \ chmod 644 /usr/share/keyrings/intel-graphics.gpg && \
\
# Update and install basic dependencies
apt-get update && \ apt-get update && \
apt-get install -y --no-install-recommends curl wget git sudo && \ apt-get install -y --no-install-recommends \
# Install PYTHON 3.11 and IPEX-LLM[xpu] curl wget git sudo libunwind8-dev vim less gnupg gpg-agent software-properties-common && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \ \
env DEBIAN_FRONTEND=noninteractive apt-get update && \ # Set timezone
apt-get install -y --no-install-recommends libunwind8-dev vim less && \ ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
# add-apt-repository requires gnupg, gpg-agent, software-properties-common echo $TZ > /etc/timezone && \
apt-get install -y --no-install-recommends gnupg gpg-agent software-properties-common && \ \
# Add Python 3.11 PPA repository # Install Python 3.11
add-apt-repository ppa:deadsnakes/ppa -y && \ add-apt-repository ppa:deadsnakes/ppa -y && \
apt-get install -y --no-install-recommends python3.11 git curl wget && \ apt-get install -y --no-install-recommends python3.11 python3-pip python3.11-dev python3.11-distutils python3-wheel && \
rm /usr/bin/python3 && \ rm /usr/bin/python3 && ln -s /usr/bin/python3.11 /usr/bin/python3 && \
ln -s /usr/bin/python3.11 /usr/bin/python3 && \
ln -s /usr/bin/python3 /usr/bin/python && \ ln -s /usr/bin/python3 /usr/bin/python && \
apt-get install -y --no-install-recommends python3-pip python3.11-dev python3-wheel python3.11-distutils && \ \
# Install pip and essential Python packages
wget https://bootstrap.pypa.io/get-pip.py -O get-pip.py && \ wget https://bootstrap.pypa.io/get-pip.py -O get-pip.py && \
python3 get-pip.py && \ python3 get-pip.py && rm get-pip.py && \
rm get-pip.py && \
pip install --upgrade requests argparse urllib3 && \ pip install --upgrade requests argparse urllib3 && \
pip install --pre --upgrade ipex-llm[cpp] && \ pip install --pre --upgrade ipex-llm[cpp] && \
# Fix Trivy CVE Issues pip install transformers==4.36.2 transformers_stream_generator einops tiktoken && \
pip install transformers==4.36.2 && \ \
pip install transformers_stream_generator einops tiktoken && \ # Remove breaks install packages
# Install opencl-related repos apt-get remove -y libze-dev libze-intel-gpu1 && \
apt-get update && \ \
# apt-get install -y --no-install-recommends intel-opencl-icd intel-level-zero-gpu=1.3.26241.33-647~22.04 level-zero level-zero-dev --allow-downgrades && \ # Install Intel GPU OpenCL Driver and Compute Runtime
mkdir -p /tmp/gpu && \ mkdir -p /tmp/gpu && cd /tmp/gpu && \
cd /tmp/gpu && \ echo "Downloading Intel Compute Runtime (24.52) for Gen12+..." && \
wget https://github.com/oneapi-src/level-zero/releases/download/v1.18.5/level-zero_1.18.5+u22.04_amd64.deb && \ wget https://github.com/intel/intel-graphics-compiler/releases/download/v2.5.6/intel-igc-core-2_2.5.6+18417_amd64.deb && \
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17791.9/intel-igc-core_1.0.17791.9_amd64.deb && \ wget https://github.com/intel/intel-graphics-compiler/releases/download/v2.5.6/intel-igc-opencl-2_2.5.6+18417_amd64.deb && \
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17791.9/intel-igc-opencl_1.0.17791.9_amd64.deb && \ wget https://github.com/intel/compute-runtime/releases/download/24.52.32224.5/intel-level-zero-gpu_1.6.32224.5_amd64.deb && \
wget https://github.com/intel/compute-runtime/releases/download/24.39.31294.12/intel-level-zero-gpu_1.6.31294.12_amd64.deb && \ wget https://github.com/intel/compute-runtime/releases/download/24.52.32224.5/intel-opencl-icd_24.52.32224.5_amd64.deb && \
wget https://github.com/intel/compute-runtime/releases/download/24.39.31294.12/intel-opencl-icd_24.39.31294.12_amd64.deb && \ wget https://github.com/intel/compute-runtime/releases/download/24.52.32224.5/libigdgmm12_22.5.5_amd64.deb && \
wget https://github.com/intel/compute-runtime/releases/download/24.39.31294.12/libigdgmm12_22.5.2_amd64.deb && \ \
dpkg -i *.deb && \ echo "Downloading Legacy Compute Runtime (24.35) for pre-Gen12 support..." && \
rm *.deb && \ wget https://github.com/intel/compute-runtime/releases/download/24.35.30872.22/intel-level-zero-gpu-legacy1_1.3.30872.22_amd64.deb && \
rm -rf /tmp/gpu && \ wget https://github.com/intel/compute-runtime/releases/download/24.35.30872.22/intel-opencl-icd-legacy1_24.35.30872.22_amd64.deb && \
mkdir -p /llm && \ wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17537.20/intel-igc-core_1.0.17537.20_amd64.deb && \
cd /llm && \ wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17537.20/intel-igc-opencl_1.0.17537.20_amd64.deb && \
# Install Dependencies \
# remove blinker to avoid error dpkg -i *.deb && rm -rf /tmp/gpu && \
\
# Install oneAPI Level Zero Loader
mkdir /tmp/level-zero && cd /tmp/level-zero && \
wget https://github.com/oneapi-src/level-zero/releases/download/v1.20.2/level-zero_1.20.2+u22.04_amd64.deb && \
wget https://github.com/oneapi-src/level-zero/releases/download/v1.20.2/level-zero-devel_1.20.2+u22.04_amd64.deb && \
dpkg -i *.deb && rm -rf /tmp/level-zero && \
\
# Clean up unnecessary dependencies to reduce image size
find /usr/lib/python3/dist-packages/ -name 'blinker*' -exec rm -rf {} + && \ find /usr/lib/python3/dist-packages/ -name 'blinker*' -exec rm -rf {} + && \
rm -rf /root/.cache/Cypress && \ rm -rf /root/.cache/Cypress && \
pip uninstall -y gunicorn python-jose PyMySQL \
# Create necessary directories
mkdir -p /llm/scripts
COPY ./start-llama-cpp.sh /llm/scripts/start-llama-cpp.sh # Copy startup scripts
COPY ./start-ollama.sh /llm/scripts/start-ollama.sh COPY ./start-llama-cpp.sh /llm/scripts/
COPY ./benchmark_llama-cpp.sh /llm/scripts/benchmark_llama-cpp.sh COPY ./start-ollama.sh /llm/scripts/
COPY ./benchmark_llama-cpp.sh /llm/scripts/
WORKDIR /llm/