-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
73 lines (59 loc) · 2.21 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
70
71
72
73
ARG BASE_IMAGE=ubuntu:20.04
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/*
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update
RUN apt-get install -y tcl
RUN apt-get -y install git
RUN apt-get install -y ffmpeg
ARG PYTHON_VERSION=3.9.12
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=2.0.0
#ARG PYTORCH_VERSION_SUFFIX=+cpu
ARG TORCHVISION_VERSION=0.15.0
#ARG TORCHVISION_VERSION_SUFFIX=+cpu
ARG TORCHAUDIO_VERSION=2.0.0
#ARG TORCHAUDIO_VERSION_SUFFIX=+cpu
ARG PYTORCH_DOWNLOAD_URL=https://download.pytorch.org/whl/cu118/torch_stable.html
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
ADD requirements.txt .
RUN python3.9 -m pip install --no-cache-dir -r requirements.txt
ADD . /workspace
CMD ["python3.9", "main.py"]
# RUN python3.9 main.py