|
| 1 | +FROM quay.io/sclorg/python-311-c9s:c9s |
| 2 | + |
| 3 | +########################### |
| 4 | +# Deploy OS Packages # |
| 5 | +########################### |
| 6 | + |
| 7 | +USER 0 |
| 8 | + |
| 9 | +WORKDIR /opt/app-root/bin/ |
| 10 | + |
| 11 | +COPY --chown=1001:0 os-ide/os-packages.txt ./os-ide/os-packages.txt |
| 12 | + |
| 13 | +RUN echo "tsflags=nodocs" | tee -a /etc/yum.conf && \ |
| 14 | + yum -y update && \ |
| 15 | + yum install -y yum-utils && \ |
| 16 | + yum-config-manager --enable crb && \ |
| 17 | + yum install -y https://download.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ |
| 18 | + yum install -y $(cat os-ide/os-packages.txt) && \ |
| 19 | + rm -f os-ide/os-packages.txt && \ |
| 20 | + yum -y clean all --enablerepo='*' && \ |
| 21 | + rm -rf /var/cache/dnf && \ |
| 22 | + find /var/log -type f -name "*.log" -exec rm -f {} \; |
| 23 | + |
| 24 | +############################################# |
| 25 | +# End of OS Packages # |
| 26 | +############################################# |
| 27 | + |
| 28 | +################################################################################################### |
| 29 | +# CUDA 12.1 Layer, from https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.1.1 # |
| 30 | +################################################################################################### |
| 31 | + |
| 32 | +USER 0 |
| 33 | + |
| 34 | +ENV NVARCH x86_64 |
| 35 | +ENV NVIDIA_REQUIRE_CUDA "cuda>=12.1 brand=tesla,driver>=470,driver<471 brand=unknown,driver>=470,driver<471 brand=nvidia,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 brand=geforce,driver>=470,driver<471 brand=geforcertx,driver>=470,driver<471 brand=quadro,driver>=470,driver<471 brand=quadrortx,driver>=470,driver<471 brand=titan,driver>=470,driver<471 brand=titanrtx,driver>=470,driver<471 brand=tesla,driver>=525,driver<526 brand=unknown,driver>=525,driver<526 brand=nvidia,driver>=525,driver<526 brand=nvidiartx,driver>=525,driver<526 brand=geforce,driver>=525,driver<526 brand=geforcertx,driver>=525,driver<526 brand=quadro,driver>=525,driver<526 brand=quadrortx,driver>=525,driver<526 brand=titan,driver>=525,driver<526 brand=titanrtx,driver>=525,driver<526" |
| 36 | +ENV NV_CUDA_CUDART_VERSION 12.1.105-1 |
| 37 | + |
| 38 | +COPY cuda.repo-x86_64 /etc/yum.repos.d/cuda.repo |
| 39 | + |
| 40 | +RUN NVIDIA_GPGKEY_SUM=d0664fbbdb8c32356d45de36c5984617217b2d0bef41b93ccecd326ba3b80c87 && \ |
| 41 | + curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/rhel9/${NVARCH}/D42D0685.pub | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \ |
| 42 | + echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict - |
| 43 | + |
| 44 | +ENV CUDA_VERSION 12.1.1 |
| 45 | + |
| 46 | +# For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a |
| 47 | +RUN yum upgrade -y && yum install -y \ |
| 48 | + cuda-cudart-12-1-${NV_CUDA_CUDART_VERSION} \ |
| 49 | + cuda-compat-12-1 \ |
| 50 | + && ln -s cuda-12.1 /usr/local/cuda \ |
| 51 | + && yum -y clean all --enablerepo='*' && \ |
| 52 | + rm -rf /var/cache/dnf && \ |
| 53 | + find /var/log -type f -name "*.log" -exec rm -f {} \; |
| 54 | + |
| 55 | +# nvidia-docker 1.0 |
| 56 | +RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \ |
| 57 | + echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf |
| 58 | + |
| 59 | +ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH} |
| 60 | +ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64 |
| 61 | + |
| 62 | +COPY NGC-DL-CONTAINER-LICENSE / |
| 63 | + |
| 64 | +# nvidia-container-runtime |
| 65 | +ENV NVIDIA_VISIBLE_DEVICES all |
| 66 | +ENV NVIDIA_DRIVER_CAPABILITIES compute,utility |
| 67 | + |
| 68 | +ENV NV_CUDA_LIB_VERSION 12.1.1-1 |
| 69 | + |
| 70 | +ENV NV_NVTX_VERSION 12.1.105-1 |
| 71 | +ENV NV_LIBNPP_VERSION 12.1.0.40-1 |
| 72 | +ENV NV_LIBNPP_PACKAGE libnpp-12-1-${NV_LIBNPP_VERSION} |
| 73 | +ENV NV_LIBCUBLAS_VERSION 12.1.3.1-1 |
| 74 | +ENV NV_LIBNCCL_PACKAGE_NAME libnccl |
| 75 | +ENV NV_LIBNCCL_PACKAGE_VERSION 2.17.1-1 |
| 76 | +ENV NV_LIBNCCL_VERSION 2.17.1 |
| 77 | +ENV NCCL_VERSION 2.17.1 |
| 78 | +ENV NV_LIBNCCL_PACKAGE ${NV_LIBNCCL_PACKAGE_NAME}-${NV_LIBNCCL_PACKAGE_VERSION}+cuda12.1 |
| 79 | + |
| 80 | +RUN yum install -y \ |
| 81 | + cuda-libraries-12-1-${NV_CUDA_LIB_VERSION} \ |
| 82 | + cuda-nvtx-12-1-${NV_NVTX_VERSION} \ |
| 83 | + ${NV_LIBNPP_PACKAGE} \ |
| 84 | + libcublas-12-1-${NV_LIBCUBLAS_VERSION} \ |
| 85 | + ${NV_LIBNCCL_PACKAGE} \ |
| 86 | + && yum -y clean all --enablerepo='*' && \ |
| 87 | + rm -rf /var/cache/dnf && \ |
| 88 | + find /var/log -type f -name "*.log" -exec rm -f {} \; |
| 89 | + |
| 90 | +# Set this flag so that libraries can find the location of CUDA |
| 91 | +ENV XLA_FLAGS=--xla_gpu_cuda_data_dir=/usr/local/cuda |
| 92 | + |
| 93 | +# CuDNN |
| 94 | +ENV NV_CUDNN_VERSION 8.9.0.131-1 |
| 95 | +ENV NV_CUDNN_PACKAGE libcudnn8-${NV_CUDNN_VERSION}.cuda12.1 |
| 96 | + |
| 97 | +RUN yum install -y \ |
| 98 | + ${NV_CUDNN_PACKAGE} \ |
| 99 | + && yum -y clean all --enablerepo='*' && \ |
| 100 | + rm -rf /var/cache/dnf && \ |
| 101 | + find /var/log -type f -name "*.log" -exec rm -f {} \; |
| 102 | + |
| 103 | +############################################# |
| 104 | +# End of CUDA 12.1 Layer # |
| 105 | +############################################# |
| 106 | + |
| 107 | +###################################### |
| 108 | +# Deploy Python packages and Jupyter # |
| 109 | +###################################### |
| 110 | + |
| 111 | +USER 1001 |
| 112 | + |
| 113 | +WORKDIR /opt/app-root/bin |
| 114 | + |
| 115 | +# Copy packages list |
| 116 | +COPY --chown=1001:0 requirements.txt ./ |
| 117 | + |
| 118 | +# Copy notebook launcher and utils |
| 119 | +COPY --chown=1001:0 utils utils/ |
| 120 | +COPY --chown=1001:0 start-notebook.sh ./ |
| 121 | + |
| 122 | +# Copy Elyra setup to utils so that it's sourced at startup |
| 123 | +COPY --chown=1001:0 setup-elyra.sh ./utils/ |
| 124 | + |
| 125 | +# Install packages and cleanup |
| 126 | +# (all commands are chained to minimize layer size) |
| 127 | +RUN echo "Installing softwares and packages" && \ |
| 128 | + # Install Python packages \ |
| 129 | + pip install --no-cache-dir --no-dependencies -r requirements.txt && \ |
| 130 | + # setup path for runtime configuration \ |
| 131 | + mkdir /opt/app-root/runtimes && \ |
| 132 | + # switch to Data Science Pipeline \ |
| 133 | + cp utils/pipeline-flow.svg /opt/app-root/lib/python3.11/site-packages/elyra/static/icons/kubeflow.svg && \ |
| 134 | + sed -i "s/Kubeflow Pipelines/Data Science/g" /opt/app-root/lib/python3.11/site-packages/elyra/pipeline/runtime_type.py && \ |
| 135 | + sed -i "s/Kubeflow Pipelines/Data Science Pipelines/g" /opt/app-root/lib/python3.11/site-packages/elyra/metadata/schemas/kfp.json && \ |
| 136 | + sed -i "s/kubeflow-service/data-science-pipeline-service/g" /opt/app-root/lib/python3.11/site-packages/elyra/metadata/schemas/kfp.json && \ |
| 137 | + sed -i "s/\"default\": \"Argo\",/\"default\": \"Tekton\",/g" /opt/app-root/lib/python3.11/site-packages/elyra/metadata/schemas/kfp.json && \ |
| 138 | + # Workaround for passing ssl_sa_cert and to ensure that Elyra redirects to a correct pipeline run URL \ |
| 139 | + patch /opt/app-root/lib/python3.11/site-packages/elyra/pipeline/kfp/kfp_authentication.py -i utils/kfp_authentication.patch && \ |
| 140 | + patch /opt/app-root/lib/python3.11/site-packages/elyra/pipeline/kfp/processor_kfp.py -i utils/processor_kfp.patch && \ |
| 141 | + # switch to Data Science Pipeline in component catalog \ |
| 142 | + DIR_COMPONENT="/opt/app-root/lib/python3.11/site-packages/elyra/metadata/schemas/local-directory-catalog.json" && \ |
| 143 | + FILE_COMPONENT="/opt/app-root/lib/python3.11/site-packages/elyra/metadata/schemas/local-file-catalog.json" && \ |
| 144 | + URL_COMPONENT="/opt/app-root/lib/python3.11/site-packages/elyra/metadata/schemas/url-catalog.json" && \ |
| 145 | + tmp=$(mktemp) && \ |
| 146 | + jq '.properties.metadata.properties.runtime_type = input' $DIR_COMPONENT utils/component_runtime.json > "$tmp" && mv "$tmp" $DIR_COMPONENT && \ |
| 147 | + jq '.properties.metadata.properties.runtime_type = input' $FILE_COMPONENT utils/component_runtime.json > "$tmp" && mv "$tmp" $FILE_COMPONENT && \ |
| 148 | + jq '.properties.metadata.properties.runtime_type = input' $URL_COMPONENT utils/component_runtime.json > "$tmp" && mv "$tmp" $URL_COMPONENT && \ |
| 149 | + sed -i "s/metadata.metadata.runtime_type/\"DATA_SCIENCE_PIPELINES\"/g" /opt/app-root/share/jupyter/labextensions/@elyra/pipeline-editor-extension/static/lib_index_js.*.js && \ |
| 150 | + # Remove Elyra logo from JupyterLab because this is not a pure Elyra image \ |
| 151 | + sed -i "s/widget\.id === \x27jp-MainLogo\x27/widget\.id === \x27jp-MainLogo\x27 \&\& false/" /opt/app-root/share/jupyter/labextensions/@elyra/theme-extension/static/lib_index_js.*.js && \ |
| 152 | + # Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \ |
| 153 | + sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \ |
| 154 | + # Remove default Elyra runtime-images \ |
| 155 | + rm /opt/app-root/share/jupyter/metadata/runtime-images/*.json && \ |
| 156 | + # Fix permissions to support pip in Openshift environments \ |
| 157 | + chmod -R g+w /opt/app-root/lib/python3.11/site-packages && \ |
| 158 | + fix-permissions /opt/app-root -P |
| 159 | + |
| 160 | +# Copy Elyra runtime-images definitions and set the version |
| 161 | +COPY --chown=1001:0 runtime-images/ /opt/app-root/share/jupyter/metadata/runtime-images/ |
| 162 | +RUN sed -i "s/RELEASE/2023c/" /opt/app-root/share/jupyter/metadata/runtime-images/*.json |
| 163 | + |
| 164 | +# Jupyter Server config to allow hidden files/folders in explorer. Ref: https://jupyterlab.readthedocs.io/en/latest/user/files.html#displaying-hidden-files |
| 165 | +# Jupyter Lab config to hide disabled exporters (WebPDF, Qtpdf, Qtpng) |
| 166 | +COPY --chown=1001:0 etc/ /opt/app-root/etc/jupyter/ |
| 167 | + |
| 168 | +WORKDIR /opt/app-root/src |
| 169 | + |
| 170 | +ENTRYPOINT ["start-notebook.sh"] |
| 171 | + |
| 172 | + |
0 commit comments