|
| 1 | +# Copyright (c) 2023 Intel Corporation |
| 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 | +# SPDX-License-Identifier: Apache-2.0 |
| 16 | + |
| 17 | + |
| 18 | +ARG BASE_IMAGE_NAME=intel/intel-optimized-pytorch |
| 19 | +ARG BASE_IMAGE_TAG=2.3.0-pip-multinode |
| 20 | + |
| 21 | +# Base image to be used everywhere |
| 22 | +FROM ${BASE_IMAGE_NAME}:${BASE_IMAGE_TAG} as base |
| 23 | +RUN apt-get clean && \ |
| 24 | + apt-get update && \ |
| 25 | + apt-get upgrade -y && \ |
| 26 | + apt-get clean autoclean && \ |
| 27 | + apt-get autoremove -y && \ |
| 28 | + rm -rf /var/lib/apt/lists/* |
| 29 | + |
| 30 | +SHELL ["/bin/bash", "-c"] |
| 31 | + |
| 32 | +RUN apt-get update -y && \ |
| 33 | + apt-get install -y --no-install-recommends --fix-missing \ |
| 34 | + google-perftools \ |
| 35 | + libjemalloc2 \ |
| 36 | + libomp-dev \ |
| 37 | + numactl |
| 38 | + |
| 39 | +WORKDIR /workspace |
| 40 | +COPY requirements.txt . |
| 41 | + |
| 42 | +RUN python -m pip install --no-cache-dir -r requirements.txt |
| 43 | + |
| 44 | +# Install OpenSSH for MPI to communicate between containers |
| 45 | +RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \ |
| 46 | + openssh-client \ |
| 47 | + openssh-server && \ |
| 48 | + rm /etc/ssh/ssh_host_*_key \ |
| 49 | + /etc/ssh/ssh_host_*_key.pub && \ |
| 50 | + apt-get clean autoclean && \ |
| 51 | + apt-get autoremove -y && \ |
| 52 | + rm -rf /var/lib/apt/lists/* |
| 53 | + |
| 54 | +# Allow OpenSSH to talk to containers without asking for confirmation |
| 55 | +# hadolint global ignore=SC2002 |
| 56 | +RUN mkdir -p /var/run/sshd && \ |
| 57 | + cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \ |
| 58 | + echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \ |
| 59 | + mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config |
| 60 | + |
| 61 | +COPY scripts /workspace/scripts/ |
| 62 | + |
| 63 | +COPY generate_ssh_keys.sh /workspace/generate_ssh_keys.sh |
| 64 | + |
| 65 | +RUN cat /workspace/generate_ssh_keys.sh >> "${HOME}/.bash_profile" && \ |
| 66 | + sed -i 's#source /inc/bin/activate##g' "${HOME}/.bashrc" && \ |
| 67 | + cat /workspace/generate_ssh_keys.sh >> "${HOME}/.bashrc" |
| 68 | + |
| 69 | +ENV BASH_ENV=${HOME}/.bash_profile |
0 commit comments