Update Dockerfile
Browse files- Dockerfile +39 -46
Dockerfile
CHANGED
@@ -1,69 +1,62 @@
|
|
1 |
-
#
|
2 |
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
5 |
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
|
7 |
-
#
|
8 |
-
RUN apt-get update && apt-get install -y
|
9 |
-
build-essential \
|
10 |
-
git \
|
11 |
-
libgl1-mesa-glx \
|
12 |
-
libglib2.0-0 \
|
13 |
-
unzip \
|
14 |
-
wget \
|
15 |
-
&& rm -rf /var/lib/apt/lists/*
|
16 |
|
17 |
-
#
|
18 |
-
RUN pip
|
19 |
|
20 |
-
#
|
|
|
|
|
21 |
RUN useradd -m -u 1000 user
|
|
|
22 |
USER user
|
23 |
-
|
24 |
-
|
25 |
-
# --- Environment Variables for caches and Gradio ---
|
26 |
ENV HOME=/home/user \
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
OMP_NUM_THREADS=1 \
|
33 |
PYTHONUNBUFFERED=1 \
|
34 |
GRADIO_ALLOW_FLAGGING=never \
|
35 |
GRADIO_NUM_PORTS=1 \
|
36 |
GRADIO_SERVER_NAME=0.0.0.0 \
|
37 |
GRADIO_THEME=huggingface \
|
38 |
GRADIO_SHARE=False \
|
39 |
-
SYSTEM=spaces
|
40 |
-
CUDA_HOME=/usr/local/cuda \
|
41 |
-
PATH=/home/user/.local/bin:$PATH \
|
42 |
-
LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH} \
|
43 |
-
LIBRARY_PATH=/usr/local/cuda/lib64/stubs:${LIBRARY_PATH} \
|
44 |
-
CUDA_DEVICE_ORDER=PCI_BUS_ID \
|
45 |
-
CUDA_VISIBLE_DEVICES=0
|
46 |
|
47 |
-
#
|
48 |
-
|
49 |
|
50 |
-
|
51 |
-
RUN mkdir -p /home/user/.cache /home/user/.local /home/user/app/bark_voices \
|
52 |
-
&& chmod -R 777 /home/user/.cache /home/user/.local /home/user/app/bark_voices
|
53 |
|
54 |
-
# --- Hack: redirect /root accesses to /home/user ---
|
55 |
USER root
|
56 |
-
RUN
|
57 |
USER user
|
58 |
|
59 |
-
#
|
60 |
-
|
61 |
-
&& cd /home/user/.cache/tts_models/multilingual/multi-dataset \
|
62 |
-
&& wget -O bark.zip "https://huggingface.co/coqui/tts_models/multilingual/multi-dataset/bark/resolve/main/bark.zip" \
|
63 |
-
&& unzip bark.zip && rm bark.zip
|
64 |
-
|
65 |
-
# --- Install Python dependencies ---
|
66 |
RUN pip install --use-feature=fast-deps -r requirements.txt gradio
|
67 |
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official PyTorch image with CUDA support as the base image
|
2 |
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
|
3 |
|
4 |
+
RUN apt-get update && apt-get install -y build-essential
|
5 |
+
|
6 |
+
# Install a specific version of pip (e.g., 20.2.4)
|
7 |
+
RUN pip install --upgrade pip
|
8 |
+
|
9 |
+
# Install Git and system libraries required for OpenGL without interactive prompts
|
10 |
ENV DEBIAN_FRONTEND=noninteractive
|
11 |
|
12 |
+
# Install Git, OpenGL libraries, and libglib2.0
|
13 |
+
RUN apt-get update && apt-get install -y git libgl1-mesa-glx libglib2.0-0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
# Set the pip resolver to "legacy"
|
16 |
+
RUN pip config set global.resolver legacy
|
17 |
|
18 |
+
#RUN apt-get update && apt-get install -y ninja-build
|
19 |
+
|
20 |
+
# Set up a new user named "user" with user ID 1000
|
21 |
RUN useradd -m -u 1000 user
|
22 |
+
# Switch to the "user" user
|
23 |
USER user
|
24 |
+
# Set environment variables
|
|
|
|
|
25 |
ENV HOME=/home/user \
|
26 |
+
CUDA_HOME=/usr/local/cuda \
|
27 |
+
PATH=/home/user/.local/bin:$PATH \
|
28 |
+
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \
|
29 |
+
LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH} \
|
30 |
+
PYTHONPATH=$HOME/app \
|
|
|
31 |
PYTHONUNBUFFERED=1 \
|
32 |
GRADIO_ALLOW_FLAGGING=never \
|
33 |
GRADIO_NUM_PORTS=1 \
|
34 |
GRADIO_SERVER_NAME=0.0.0.0 \
|
35 |
GRADIO_THEME=huggingface \
|
36 |
GRADIO_SHARE=False \
|
37 |
+
SYSTEM=spaces
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
# Set the working directory to the user's home directory
|
40 |
+
WORKDIR $HOME/app
|
41 |
|
42 |
+
COPY . .
|
|
|
|
|
43 |
|
|
|
44 |
USER root
|
45 |
+
RUN chmod -R 777 $HOME/app/bark_voices
|
46 |
USER user
|
47 |
|
48 |
+
# Install dependencies
|
49 |
+
# Use the new pip resolver and always take the latest version if not specified
|
|
|
|
|
|
|
|
|
|
|
50 |
RUN pip install --use-feature=fast-deps -r requirements.txt gradio
|
51 |
|
52 |
+
|
53 |
+
# Update package lists and install other dependencies as needed
|
54 |
+
# Ensure that CUDA components are correctly installed and configured
|
55 |
+
# Install any other required packages
|
56 |
+
|
57 |
+
# Set the environment variable to specify the GPU device
|
58 |
+
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
|
59 |
+
ENV CUDA_VISIBLE_DEVICES=0
|
60 |
+
|
61 |
+
# Run your app.py script
|
62 |
+
CMD ["python", "app.py"]
|