@@ -13,55 +13,62 @@ RUN if [ -f /etc/apt/apt.conf.d/proxy.conf ]; then rm /etc/apt/apt.conf.d/proxy.
13
13
RUN apt update && \
14
14
apt full-upgrade -y && \
15
15
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
16
- sudo \
17
16
ca-certificates \
18
17
git \
19
18
curl \
20
19
wget \
21
20
vim \
21
+ python3 \
22
+ python3-dev \
23
+ python3-pip \
22
24
numactl \
23
25
gcc-12 \
24
26
g++-12 \
25
- make
27
+ make \
28
+ cmake
26
29
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 && \
27
30
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 && \
28
31
update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 100 && \
29
- update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 100
30
- RUN apt clean && \
31
- rm -rf /var/lib/apt/lists/* && \
32
- if [ -f /etc/apt/apt.conf.d/proxy.conf ]; then rm /etc/apt/apt.conf.d/proxy.conf; fi
32
+ update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 100 && \
33
+ update-alternatives --install /usr/bin/python python /usr/bin/python3 100
33
34
34
- RUN useradd -m ubuntu && \
35
- echo 'ubuntu ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
36
- USER ubuntu
37
- WORKDIR /home/ubuntu
38
-
39
- RUN curl -fsSL -v -o miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
40
- bash miniconda.sh -b -p ./miniconda3 && \
41
- rm miniconda.sh && \
42
- echo "source ~/miniconda3/bin/activate" >> ./.bashrc
35
+ WORKDIR /root
36
+ ENV PATH=/root/.local/bin:${PATH}
43
37
44
38
# --build-arg COMPILE=ON to compile from source
45
39
FROM base AS dev
46
40
ARG COMPILE
47
- COPY --chown=ubuntu:ubuntu . ./intel-extension-for-pytorch
48
- RUN . ./miniconda3/bin/activate && \
49
- conda create -y -n compile_py310 python=3.10 && conda activate compile_py310 && \
50
- cd intel-extension-for-pytorch/examples/cpu/inference/python/llm && \
51
- if [ -z ${COMPILE} ]; then bash tools/env_setup.sh 6; else bash tools/env_setup.sh 2; fi
41
+ COPY . ./intel-extension-for-pytorch
42
+ RUN cd intel-extension-for-pytorch/examples/cpu/inference/python/llm && \
43
+ export CC=gcc && export CXX=g++ && \
44
+ if [ -z ${COMPILE} ]; then bash tools/env_setup.sh 6; else bash tools/env_setup.sh 2; fi && \
45
+ unset CC && unset CXX
52
46
53
47
FROM base AS deploy
54
- COPY --from=dev --chown=ubuntu:ubuntu /home/ubuntu/intel-extension-for-pytorch/examples/cpu/inference/python/llm ./llm
55
- RUN rm ./llm/tools/get_libstdcpp_lib.sh
56
- COPY --from=dev --chown=ubuntu:ubuntu /home/ubuntu/intel-extension-for-pytorch/examples/cpu/inference/python/llm/tools/get_libstdcpp_lib.sh ./llm/tools/get_libstdcpp_lib.sh
57
- RUN . ./miniconda3/bin/activate && \
58
- conda create -y -n py310 python=3.10 && conda activate py310 && \
59
- echo "conda activate py310" >> ./.bashrc && \
48
+ RUN apt update && \
49
+ DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
50
+ google-perftools \
51
+ openssh-server \
52
+ net-tools && \
53
+ apt clean && \
54
+ rm -rf /var/lib/apt/lists/* && \
55
+ if [ -f /etc/apt/apt.conf.d/proxy.conf ]; then rm /etc/apt/apt.conf.d/proxy.conf; fi
56
+ COPY --from=dev /root/intel-extension-for-pytorch/examples/cpu/inference/python/llm ./llm
57
+ COPY --from=dev /root/intel-extension-for-pytorch/tools/get_libstdcpp_lib.sh ./llm/tools
58
+ RUN cd /usr/lib/x86_64-linux-gnu/ && ln -s libtcmalloc.so.4 libtcmalloc.so && cd && \
60
59
echo "echo \" **Note:** For better performance, please consider to launch workloads with command 'ipexrun'.\" " >> ./.bashrc && \
61
60
cd ./llm && \
62
61
bash tools/env_setup.sh 1 && \
63
62
python -m pip cache purge && \
64
- conda clean -a -y && \
65
- sudo mv ./oneCCL_release /opt/oneCCL && \
66
- sudo chown -R root:root /opt/oneCCL && \
67
- sed -i "s|ONECCL_PATH=.*|ONECCL_PATH=/opt/oneCCL|" ./tools/env_activate.sh
63
+ mv ./oneCCL_release /opt/oneCCL && \
64
+ chown -R root:root /opt/oneCCL && \
65
+ sed -i "s|ONECCL_PATH=.*|ONECCL_PATH=/opt/oneCCL|" ./tools/env_activate.sh && \
66
+ LN=$(grep "Conda environment is not available." -n ./tools/env_activate.sh | cut -d ":" -f 1) && sed -i "${LN}s|.*| export LD_PRELOAD=\$ {LD_PRELOAD}:/usr/lib/x86_64-linux-gnu/libtcmalloc.so:/usr/local/lib/libiomp5.so|" ./tools/env_activate.sh
67
+ ARG PORT_SSH=22
68
+ RUN mkdir /var/run/sshd && \
69
+ sed -i "s/#Port.*/Port ${PORT_SSH}/" /etc/ssh/sshd_config && \
70
+ echo "service ssh start" >> /root/.bashrc && \
71
+ ssh-keygen -b 4096 -f /root/.ssh/id_rsa -N "" && \
72
+ mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \
73
+ echo "Host *\n Port ${PORT_SSH}\n IdentityFile /root/.ssh/id_rsa\n StrictHostKeyChecking no" > /root/.ssh/config
74
+ EXPOSE ${PORT_SSH}
0 commit comments