forked from quic/aimet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.new
64 lines (52 loc) · 2.68 KB
/
Dockerfile.new
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
ARG BASE_IMAGE
FROM $BASE_IMAGE as build
ARG PY=3.6
ARG BUILD_DIR=/tmp/build
ARG AIMET_CU_VER="cpu"
ARG AIMET_TF_VER=""
ARG AIMET_PT_VER=""
RUN --mount=type=cache,target=/var/cache/apt \
set -x; apt update \
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install --no-install-recommends -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install --no-install-recommends -y curl python${PY}-dev python${PY}-distutils \
&& update-alternatives --install /usr/bin/python3 python /usr/bin/python${PY} 10 \
&& curl -kL "https://bootstrap.pypa.io/pip/3.6/get-pip.py" | python3
ENV AIMET_CU_VER=${AIMET_CU_VER} \
AIMET_TF_VER=${AIMET_TF_VER} \
AIMET_PT_VER=${AIMET_PT_VER}
COPY ./packaging/dependencies.py /aimet-src/
RUN --mount=type=cache,target=/var/cache/apt \
apt update \
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install --no-install-recommends -y \
`/aimet-src/dependencies.py apt --dev`
RUN --mount=type=cache,target=/root/.cache/pip \
python3 -m pip install `python3 /aimet-src/dependencies.py pip --dev`
ENV GIT_SSL_NO_VERIFY=true
ENV PYTHONDONTWRITEBYTECODE=TRUE
COPY . /aimet-src
RUN cmake --version \
&& cmake -S /aimet-src -B $BUILD_DIR -GNinja \
-DENABLE_CUDA=`if [ "$AIMET_CU_VER" = "cpu" ]; then echo "OFF"; else echo "ON"; fi` \
-DENABLE_TORCH=`if [ "$AIMET_PT_VER" = "" ]; then echo "OFF"; else echo "ON"; fi` \
-DENABLE_TENSORFLOW=`if [ "$AIMET_TF_VER" = "" ]; then echo "OFF"; else echo "ON"; fi` \
&& cmake --build $BUILD_DIR --parallel --target all \
&& ( PYTEST_ADDOPTS='-m "not cuda"' cmake --build $BUILD_DIR --parallel --target test || cat /tmp/build/Testing/Temporary/LastTest.log ) \
&& cmake --build $BUILD_DIR --parallel --target whl_build \
&& ls -la $BUILD_DIR/*
FROM $BASE_IMAGE
ARG PY=3.6
ARG BUILD_DIR=/tmp/build
COPY ./packaging/dependencies.py /tmp/
COPY --from=0 $BUILD_DIR/whlprep/*.whl /tmp/
RUN --mount=type=cache,target=/var/cache/apt \
apt update \
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install --no-install-recommends -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt update \
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install --no-install-recommends -y curl python${PY} python${PY}-distutils \
&& update-alternatives --install /usr/bin/python3 python /usr/bin/python${PY} 10 \
&& curl -kL "https://bootstrap.pypa.io/pip/3.6/get-pip.py" | python3
RUN --mount=type=cache,target=/root/.cache/pip \
python3 -m pip install --upgrade pip wheel \
&& python3 -m pip install --extra-index-url https://download.pytorch.org/whl /tmp/*.whl