Skip to content

Commit 50d0f2f

Browse files
geekloperAbdellah Derfoufi
andauthored
Added NVIDIA GPU support to Docker (#1231)
* Added NVIDIA GPU support to Docker * feat: Added NVIDIA GPU support to Docker --------- Co-authored-by: Abdellah Derfoufi <[email protected]>
1 parent e4e2f7f commit 50d0f2f

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

Dockerfile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM python:3.10-bullseye
3+
FROM nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04
44

55
EXPOSE 7865
66

77
WORKDIR /app
88

99
COPY . .
1010

11-
RUN apt update && apt install -y -qq ffmpeg aria2 && apt clean
11+
# Install dependenceis to add PPAs
12+
RUN apt-get update && \
13+
apt-get install -y -qq ffmpeg aria2 && apt clean && \
14+
apt-get install -y software-properties-common && \
15+
apt-get clean && \
16+
rm -rf /var/lib/apt/lists/*
1217

13-
RUN pip3 install --no-cache-dir -r requirements.txt
18+
# Add the deadsnakes PPA to get Python 3.9
19+
RUN add-apt-repository ppa:deadsnakes/ppa
20+
21+
# Install Python 3.9 and pip
22+
RUN apt-get update && \
23+
apt-get install -y build-essential python-dev python3-dev python3.9-distutils python3.9-dev python3.9 curl && \
24+
apt-get clean && \
25+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 && \
26+
curl https://bootstrap.pypa.io/get-pip.py | python3.9
27+
28+
# Set Python 3.9 as the default
29+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
30+
31+
RUN python3 -m pip install --no-cache-dir -r requirements.txt
1432

1533
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/D40k.pth -d assets/pretrained_v2/ -o D40k.pth
1634
RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/pretrained_v2/G40k.pth -d assets/pretrained_v2/ -o G40k.pth

docker-compose.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,11 @@ services:
1010
- ./opt:/app/opt
1111
# - ./dataset:/app/dataset # you can use this folder in order to provide your dataset for model training
1212
ports:
13-
- 7865:7865
13+
- 7865:7865
14+
deploy:
15+
resources:
16+
reservations:
17+
devices:
18+
- driver: nvidia
19+
count: 1
20+
capabilities: [gpu]

0 commit comments

Comments
 (0)