-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathDockerfile
57 lines (49 loc) · 1.8 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
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES:-compute,utility}
RUN apt update && \
apt install -y \
wget build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev \
libreadline-dev libffi-dev libsqlite3-dev libbz2-dev liblzma-dev && \
apt clean && \
rm -rf /var/lib/apt/lists/*
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