-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (32 loc) · 1.22 KB
/
Dockerfile
File metadata and controls
40 lines (32 loc) · 1.22 KB
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
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
# Avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Set working directory
WORKDIR /workspace
RUN apt-get update && apt-get install -y \
wget curl git build-essential \
libssl-dev zlib1g-dev libbz2-dev libreadline-dev \
libsqlite3-dev libncursesw5-dev xz-utils tk-dev \
libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
&& wget https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tgz \
&& tar xvf Python-3.11.9.tgz \
&& cd Python-3.11.9 \
&& ./configure --enable-optimizations \
&& make -j$(nproc) \
&& make altinstall \
&& ln -sf /usr/local/bin/python3.11 /usr/bin/python \
&& ln -sf /usr/local/bin/pip3.11 /usr/bin/pip \
&& cd .. && rm -rf Python-3.11.9 Python-3.11.9.tgz
# Upgrade pip and install torch with CUDA 12.3
RUN pip install --upgrade pip
# Copy and install project dependencies
COPY requirements.txt ./
RUN pip install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu121 \
&& pip install -r requirements.txt --no-deps \
--root-user-action=ignore
# Copy project files
COPY . .
# Expose Gradio port
EXPOSE 7860
# Default shell on container start
CMD ["/bin/bash"]