forked from opendilab/DI-hpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (55 loc) · 2.66 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
FROM nvidia/cuda:11.6.0-devel-ubuntu20.04 AS di-hpc-develop
ENV TZ="Asia/Beijing"
ARG DEBIAN_FRONTEND="noninteractive"
RUN mkdir -p /workspace
WORKDIR /workspace
RUN apt update \
&& apt-get install build-essential checkinstall -y \
&& apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y \
&& apt install libffi-dev gnupg pciutils make wget git vim locales -y \
&& apt clean \
&& rm -rf /var/cache/apt/* \
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
RUN cd /workspace/ \
&& wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz \
&& tar xzf Python-3.8.13.tgz \
&& cd Python-3.8.13 \
&& ./configure --enable-optimizations \
&& make altinstall \
&& ln -s /usr/local/bin/python3.8 /usr/bin/python3.8.13 \
&& ln -s /usr/local/bin/python3.8 /usr/bin/python3.8 \
&& ln -s /usr/local/bin/python3.8 /usr/bin/python3 \
&& ln -s /usr/local/bin/python3.8 /usr/bin/python \
&& ln -s /usr/local/bin/pip3.8 /usr/bin/pip3 \
&& ln -s /usr/local/bin/pip3.8 /usr/bin/pip \
&& cd /workspace/ \
&& rm -rf ./Python-3.8.13*
RUN cd /workspace/ \
&& wget https://download.pytorch.org/whl/cu113/torch-1.11.0%2Bcu113-cp38-cp38-linux_x86_64.whl -O torch-1.10.0+cu113-cp38-cp38-linux_x86_64.whl \
&& pip install --no-cache-dir /workspace/torch-1.10.0+cu113-cp38-cp38-linux_x86_64.whl \
&& rm /workspace/torch-1.10.0+cu113-cp38-cp38-linux_x86_64.whl
ADD setup.py /workspace/setup.py
ADD hpc_rll /workspace/hpc_rll
ADD include /workspace/include
ADD src /workspace/src
ADD tests /workspace/tests
RUN python /workspace/setup.py install
FROM nvidia/cuda:11.6.0-runtime-ubuntu20.04 AS di-hpc-runtime
COPY --from=di-hpc-develop /usr/local/bin/ /usr/local/bin/
COPY --from=di-hpc-develop /usr/local/include/ /usr/local/include/
COPY --from=di-hpc-develop /usr/local/lib/ /usr/local/lib/
COPY --from=di-hpc-develop /usr/local/share/ /usr/local/share/
RUN ln -s /usr/local/bin/python3.8 /usr/bin/python3 \
&& ln -s /usr/local/bin/python3.8 /usr/bin/python \
&& ln -s /usr/local/bin/pip3.8 /usr/bin/pip3 \
&& ln -s /usr/local/bin/pip3.8 /usr/bin/pip
FROM ubuntu:20.04 AS di-hpc-nightly
COPY --from=di-hpc-develop /usr/local/bin/ /usr/local/bin/
COPY --from=di-hpc-develop /usr/local/include/ /usr/local/include/
COPY --from=di-hpc-develop /usr/local/lib/ /usr/local/lib/
COPY --from=di-hpc-develop /usr/local/share/ /usr/local/share/
RUN ln -s /usr/local/bin/python3.8 /usr/bin/python3 \
&& ln -s /usr/local/bin/python3.8 /usr/bin/python \
&& ln -s /usr/local/bin/pip3.8 /usr/bin/pip3 \
&& ln -s /usr/local/bin/pip3.8 /usr/bin/pip