forked from quic/aimet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.ci
72 lines (64 loc) · 2.79 KB
/
Dockerfile.ci
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
ARG BASE_IMAGE=ubuntu:22.04
FROM $BASE_IMAGE AS build
ENV CONDA_PREFIX=/opt/conda
ENV CONDA=${CONDA_PREFIX}/bin/conda
ENV CONDA_DEFAULT_ENV=dev
RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt install --yes --no-install-recommends \
acl \
ca-certificates \
curl \
# manylinux2014 requires gcc 10 and cuda doesn't support gcc>11
g++-10 \
git \
jq \
libeigen3-dev \
libz-dev \
make \
pkg-config \
sudo \
&& rm -rf /var/lib/apt/lists/* \
&& echo '%users ALL = (ALL) NOPASSWD: ALL' > /etc/sudoers.d/passwordless \
&& curl -o /tmp/conda.sh -L 'https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh' \
&& mkdir -m 777 -p ${CONDA_PREFIX} \
&& setfacl -d -m o::rwx ${CONDA_PREFIX} \
&& bash /tmp/conda.sh -u -b -p ${CONDA_PREFIX} \
&& rm /tmp/conda.sh \
&& ${CONDA} config --set channel_priority strict \
&& ${CONDA} init --no-user --system --all \
&& ${CONDA} install -y conda-devenv \
&& ${CONDA} clean --yes --all --verbose \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 \
&& git config --system --add safe.directory '*'
ARG VER_PYTHON=3.8
ARG VER_CUDA=11.7.1
ARG VER_TORCH=""
ARG VER_TENSORFLOW=""
ARG VER_ONNX=""
COPY Jenkins/fast-release/environment.devenv.yml /tmp/
RUN export PATH=$PATH:${CONDA_PREFIX}/bin PIP_NO_CACHE_DIR=1 \
&& ${CONDA} devenv \
--env-var ENV_NAME="${CONDA_DEFAULT_ENV}" \
--env-var VER_PYTHON="${VER_PYTHON}" \
--env-var VER_CUDA="${VER_CUDA}" \
--file /tmp/environment.devenv.yml \
--output-file /tmp/environment.yml \
&& cat /tmp/environment.yml \
&& ${CONDA} clean --yes --all --verbose \
&& echo "conda activate ${CONDA_DEFAULT_ENV}" >> /etc/profile.d/conda.sh \
&& rm -rf ~/.conda*
RUN --mount=type=bind,target=/workspace \
echo "Install all required dependencies" \
&& export PIP_NO_CACHE_DIR=1 \
&& export PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/$(echo $VER_CUDA | awk -F'.' '{print ($1!="")? "cu"$1$2 : "cpu"}')" \
&& export CMAKE_ARGS="\
-DENABLE_TENSORFLOW=$([ -z ${VER_TENSORFLOW} ]; echo $?) \
-DENABLE_TORCH=$([ -z ${VER_TORCH} ]; echo $?) \
-DENABLE_ONNX=$([ -z ${VER_ONNX} ]; echo $?) \
-DENABLE_CUDA=$([ -z ${VER_CUDA} ]; echo $?) \
" \
&& ${CONDA} run --name ${CONDA_DEFAULT_ENV} --live-stream \
bash -c 'python3 -m piptools compile --output-file=- --resolver=backtracking --extra=.,dev,test /workspace/pyproject.toml | python3 -m pip install -r /dev/stdin'
ENV PYTHONPYCACHEPREFIX=/tmp
ENTRYPOINT ["/bin/bash", "--login", "-c", "${0#--} \"$@\""]
CMD ["/bin/bash"]