-
Notifications
You must be signed in to change notification settings - Fork 61
/
Dockerfile
55 lines (47 loc) · 1.89 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
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES:-compute,utility}
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \
yum install -y wget gcc make openssl-devel tk-devel xz-devel zlib-devel bzip2-devel ncurses-devel gdbm-devel \
readline-devel sqlite-devel libffi-devel
ARG PYTHON_VERSION
RUN cd /tmp && \
wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz && \
tar -xvf Python-${PYTHON_VERSION}.tgz && \
cd Python-${PYTHON_VERSION} && \
./configure --enable-optimizations && \
make && make install && \
cd .. && rm Python-${PYTHON_VERSION}.tgz && rm -r Python-${PYTHON_VERSION} && \
ln -s /usr/local/bin/python3 /usr/local/bin/python && \
ln -s /usr/local/bin/pip3 /usr/local/bin/pip && \
python -m pip install --upgrade pip && \
rm -r /root/.cache/pip
ARG PYTORCH_VERSION
ARG PYTORCH_VERSION_SUFFIX
ARG TORCHVISION_VERSION
ARG TORCHVISION_VERSION_SUFFIX
ARG TORCHAUDIO_VERSION
ARG TORCHAUDIO_VERSION_SUFFIX
ARG PYTORCH_DOWNLOAD_URL
RUN if [ ! $TORCHAUDIO_VERSION ]; \
then \
TORCHAUDIO=; \
else \
TORCHAUDIO=torchaudio==${TORCHAUDIO_VERSION}${TORCHAUDIO_VERSION_SUFFIX}; \
fi && \
if [ ! $PYTORCH_DOWNLOAD_URL ]; \
then \
pip install \
torch==${PYTORCH_VERSION}${PYTORCH_VERSION_SUFFIX} \
torchvision==${TORCHVISION_VERSION}${TORCHVISION_VERSION_SUFFIX} \
${TORCHAUDIO}; \
else \
pip install \
torch==${PYTORCH_VERSION}${PYTORCH_VERSION_SUFFIX} \
torchvision==${TORCHVISION_VERSION}${TORCHVISION_VERSION_SUFFIX} \
${TORCHAUDIO} \
-f ${PYTORCH_DOWNLOAD_URL}; \
fi && \
rm -r /root/.cache/pip
WORKDIR /workspace