Spaces:
Runtime error
Runtime error
Updated Dockerfile for GPU Dependencies
Browse files- Dockerfile +21 -7
Dockerfile
CHANGED
@@ -1,20 +1,34 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
4 |
|
5 |
-
|
|
|
|
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
|
|
|
|
|
9 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
10 |
|
|
|
11 |
RUN useradd -m -u 1000 user
|
12 |
USER user
|
13 |
ENV HOME=/home/user \
|
14 |
-
|
15 |
|
|
|
16 |
WORKDIR $HOME/app
|
17 |
-
|
18 |
COPY --chown=user . $HOME/app
|
19 |
|
20 |
-
|
|
|
|
1 |
+
# Use an appropriate base image with Ubuntu
|
2 |
+
FROM nvidia/cuda:11.2.1-base-ubuntu20.04 # Adjust the CUDA version as needed
|
3 |
|
4 |
+
# Set environment variables for CUDA
|
5 |
+
ENV CUDA_HOME=/usr/local/cuda
|
6 |
+
ENV PATH=$CUDA_HOME/bin:$PATH
|
7 |
+
ENV LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
|
8 |
|
9 |
+
# Install NVIDIA driver
|
10 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
11 |
+
nvidia-driver-460.106 # Use the specific driver version you found
|
12 |
|
13 |
+
# Additional system dependencies
|
14 |
+
RUN apt-get install -y ffmpeg && apt-get install -y yt-dlp
|
15 |
+
|
16 |
+
# Switch back to the root user to install Python packages
|
17 |
+
USER root
|
18 |
|
19 |
+
# Copy your requirements.txt and install Python packages
|
20 |
+
COPY ./requirements.txt /code/requirements.txt
|
21 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
22 |
|
23 |
+
# Create a non-root user and set environment variables
|
24 |
RUN useradd -m -u 1000 user
|
25 |
USER user
|
26 |
ENV HOME=/home/user \
|
27 |
+
PATH=/home/user/.local/bin:$PATH
|
28 |
|
29 |
+
# Set the working directory and copy your application files
|
30 |
WORKDIR $HOME/app
|
|
|
31 |
COPY --chown=user . $HOME/app
|
32 |
|
33 |
+
# Specify the command to run your application
|
34 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|