|
| 1 | +# Copyright 2019 The TensorFlow Authors. 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 | +# |
| 16 | +# |
| 17 | +# This file was assembled from multiple pieces, whose use is documented |
| 18 | +# throughout. Please refer to the TensorFlow dockerfiles documentation |
| 19 | +# for more information. |
| 20 | + |
| 21 | +ARG REGISTRY |
| 22 | +ARG REPO |
| 23 | +ARG GITHUB_RUN_NUMBER |
| 24 | +ARG BASE_IMAGE_NAME |
| 25 | +ARG BASE_IMAGE_TAG |
| 26 | +ARG PACKAGE_OPTION=pip |
| 27 | +ARG PYTHON_VERSION |
| 28 | +ARG PYTHON_BASE=${REGISTRY}/${REPO}:b-${GITHUB_RUN_NUMBER}-${BASE_IMAGE_NAME}-${BASE_IMAGE_TAG}-${PACKAGE_OPTION}-py${PYTHON_VERSION}-base |
| 29 | +ARG TORCHSERVE_BASE=${PYTHON_BASE} |
| 30 | +FROM ${PYTHON_BASE} AS xpu-base |
| 31 | + |
| 32 | +RUN apt-get update && \ |
| 33 | + apt-get install -y --no-install-recommends --fix-missing \ |
| 34 | + apt-utils \ |
| 35 | + build-essential \ |
| 36 | + clinfo \ |
| 37 | + git \ |
| 38 | + gnupg2 \ |
| 39 | + gpg-agent \ |
| 40 | + rsync \ |
| 41 | + unzip && \ |
| 42 | + apt-get clean && \ |
| 43 | + rm -rf /var/lib/apt/lists/* |
| 44 | + |
| 45 | +RUN wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \ |
| 46 | + gpg --dearmor --yes --output /usr/share/keyrings/intel-graphics.gpg |
| 47 | +RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy unified" | \ |
| 48 | + tee /etc/apt/sources.list.d/intel-gpu-jammy.list |
| 49 | + |
| 50 | +ARG ICD_VER |
| 51 | +ARG LEVEL_ZERO_GPU_VER |
| 52 | +ARG LEVEL_ZERO_VER |
| 53 | +ARG LEVEL_ZERO_DEV_VER |
| 54 | + |
| 55 | +RUN apt-get update && \ |
| 56 | + apt-get install -y --no-install-recommends --fix-missing \ |
| 57 | + intel-opencl-icd=${ICD_VER} \ |
| 58 | + intel-level-zero-gpu=${LEVEL_ZERO_GPU_VER} \ |
| 59 | + libze1=${LEVEL_ZERO_VER} \ |
| 60 | + libze-dev=${LEVEL_ZERO_DEV_VER} && \ |
| 61 | + rm -rf /var/lib/apt/lists/* |
| 62 | + |
| 63 | +RUN no_proxy="" NO_PROXY="" wget --progress=dot:giga -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ |
| 64 | + | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \ |
| 65 | + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \ |
| 66 | + | tee /etc/apt/sources.list.d/oneAPI.list |
| 67 | + |
| 68 | +ARG DPCPP_VER |
| 69 | +ARG MKL_VER |
| 70 | +ARG CCL_VER |
| 71 | + |
| 72 | +RUN apt-get update && \ |
| 73 | + apt-get install -y --no-install-recommends --fix-missing \ |
| 74 | + intel-oneapi-runtime-dpcpp-cpp=${DPCPP_VER} \ |
| 75 | + intel-oneapi-runtime-mkl=${MKL_VER} \ |
| 76 | + intel-oneapi-runtime-ccl=${CCL_VER} && \ |
| 77 | + rm -rf /var/lib/apt/lists/* |
| 78 | + |
| 79 | +RUN rm -rf /etc/apt/sources.list.d/intel-gpu-jammy.list /etc/apt/sources.list.d/oneAPI.list |
| 80 | + |
| 81 | +ENV OCL_ICD_VENDORS=/etc/OpenCL/vendors |
| 82 | + |
| 83 | +FROM xpu-base AS jax-base |
| 84 | + |
| 85 | +WORKDIR / |
| 86 | +COPY requirements.txt . |
| 87 | + |
| 88 | +RUN python -m pip install --no-cache-dir -r requirements.txt && \ |
| 89 | + rm -rf requirements.txt |
| 90 | + |
| 91 | +FROM jax-base AS jupyter |
| 92 | + |
| 93 | +WORKDIR /jupyter |
| 94 | +COPY jupyter-requirements.txt . |
| 95 | + |
| 96 | +RUN python -m pip install --no-cache-dir -r jupyter-requirements.txt && \ |
| 97 | + rm -rf jupyter-requirements.txt |
| 98 | + |
| 99 | +RUN mkdir -p /jupyter/ && chmod -R a+rwx /jupyter/ |
| 100 | +RUN mkdir /.local && chmod a+rwx /.local |
| 101 | + |
| 102 | +EXPOSE 8888 |
| 103 | + |
| 104 | +CMD ["bash", "-c", "source /etc/bash.bashrc && jupyter notebook --notebook-dir=/jupyter --port 8888 --ip 0.0.0.0 --no-browser --allow-root --ServerApp.token= --ServerApp.password= --ServerApp.allow_origin=* --ServerApp.base_url=$NB_PREFIX"] |
0 commit comments