-
Notifications
You must be signed in to change notification settings - Fork 270
/
Copy pathDockerfile
77 lines (72 loc) · 2.97 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copyright (c) 2024 Intel Corporation
# SPDX-License-Identifier: Apache 2.0
ARG BASE_IMAGE=ubuntu:22.04
FROM ${BASE_IMAGE} AS base
SHELL ["/bin/bash", "-c"]
RUN if [ -f /etc/apt/apt.conf.d/proxy.conf ]; then rm /etc/apt/apt.conf.d/proxy.conf; fi && \
if [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::Proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf.d/proxy.conf; fi && \
if [ ! -z ${HTTPS_PROXY} ]; then echo "Acquire::https::Proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf.d/proxy.conf; fi
RUN apt update && \
apt full-upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
git \
curl \
wget \
vim \
patch \
gcc \
g++ \
make \
libgomp1 \
pkg-config \
unzip \
zip \
software-properties-common \
gnupg \
gpg-agent
COPY ./scripts/tools/compilation_helper/basekit_driver_install_helper.sh .
RUN bash ./basekit_driver_install_helper.sh driver
WORKDIR /root
RUN curl -fsSL -v -o miniforge.sh -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh && \
bash miniforge.sh -b -p ./miniforge3 && \
rm miniforge.sh
FROM base AS dev
# --build-arg COMPILE=ON to compile from source
ARG COMPILE
ARG AOT
COPY . ./intel-extension-for-pytorch/
RUN . ./miniforge3/bin/activate && \
if [ ! -z "${COMPILE}" ]; then bash /basekit_driver_install_helper.sh dev; fi && \
conda create -y -n compile_py310 python=3.10 && conda activate compile_py310 && \
ARGS="--setup"; \
if [ ! -z "${COMPILE}" ] && \
( [ "${COMPILE}" == "ON" ] || \
[ "${COMPILE}" == "on" ] || \
[ "${COMPILE}" == "1" ] ); then \
if [ ! -z "${AOT}" ]; then \
ARGS="${ARGS} --install-pytorch compile --aot ${AOT}"; \
fi; \
ARGS="${ARGS} --oneapi-root-dir /opt/intel/oneapi"; \
fi; \
python ./intel-extension-for-pytorch/examples/gpu/llm/tools/env_setup.py ${ARGS}
FROM base AS deploy
COPY --from=dev /root/intel-extension-for-pytorch/examples/gpu/llm ./llm
COPY --from=dev /root/intel-extension-for-pytorch/scripts/tools/compilation_helper/get_libstdcpp_lib.sh ./llm/tools
RUN apt clean && \
rm -rf /var/lib/apt/lists/* && \
if [ -f /etc/apt/apt.conf.d/proxy.conf ]; then rm /etc/apt/apt.conf.d/proxy.conf; fi && \
rm /basekit_driver_install_helper.sh
RUN . ./miniforge3/bin/activate && \
conda create -y -n py310 python=3.10 && conda activate py310 && conda install -y libstdcxx-ng && \
cd ./llm && \
python tools/env_setup.py --deploy && \
python -m pip cache purge && \
conda clean -a -y
RUN ENTRYPOINT=/usr/local/bin/entrypoint.sh && \
echo "#!/bin/bash" > ${ENTRYPOINT} && \
echo "CMDS=(); while [ \$# -gt 0 ]; do CMDS+=(\"\$1\"); shift; done;" >> ${ENTRYPOINT} && \
echo ". ~/miniforge3/bin/activate" >> ${ENTRYPOINT} && \
echo "conda activate py310" >> ${ENTRYPOINT} && \
echo "\"\${CMDS[@]}\"" >> ${ENTRYPOINT} && \
chmod +x ${ENTRYPOINT}
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]