Spaces:
Runtime error
Runtime error
Commit ·
5ad643a
1
Parent(s): 906fc1d
Explicitly add CUDA
Browse files- Dockerfile +11 -15
Dockerfile
CHANGED
|
@@ -1,18 +1,9 @@
|
|
| 1 |
FROM nvidia/cuda:12.4.1-cudnn8-runtime-ubuntu22.04
|
| 2 |
|
| 3 |
-
# Install Python and
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
python3.10 \
|
| 6 |
python3-pip \
|
| 7 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
-
|
| 9 |
-
# Create Python 3.10 symlink
|
| 10 |
-
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
|
| 11 |
-
|
| 12 |
-
WORKDIR /code
|
| 13 |
-
|
| 14 |
-
# Install build tools and system dependencies
|
| 15 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 16 |
build-essential \
|
| 17 |
gcc \
|
| 18 |
g++ \
|
|
@@ -21,12 +12,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 21 |
libsm6 \
|
| 22 |
libxext6 \
|
| 23 |
libxrender-dev \
|
|
|
|
|
|
|
| 24 |
&& rm -rf /var/lib/apt/lists/*
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
# Copy requirements first for better layer caching
|
| 27 |
COPY requirements.txt .
|
| 28 |
|
| 29 |
-
# Install Python packages
|
| 30 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
| 31 |
pip install --no-cache-dir -r requirements.txt
|
| 32 |
|
|
@@ -35,12 +33,10 @@ COPY . .
|
|
| 35 |
# Set environment variables for CUDA
|
| 36 |
ENV CUDA_HOME=/usr/local/cuda
|
| 37 |
ENV PATH=${CUDA_HOME}/bin:${PATH}
|
| 38 |
-
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:
|
| 39 |
ENV INSIGHTFACE_HOME=/tmp/.insightface
|
| 40 |
ENV MPLCONFIGDIR=/tmp/matplotlib
|
| 41 |
|
| 42 |
EXPOSE 7860
|
| 43 |
|
| 44 |
-
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 45 |
-
|
| 46 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM nvidia/cuda:12.4.1-cudnn8-runtime-ubuntu22.04
|
| 2 |
|
| 3 |
+
# Install Python and required system libraries
|
| 4 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
python3.10 \
|
| 6 |
python3-pip \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
build-essential \
|
| 8 |
gcc \
|
| 9 |
g++ \
|
|
|
|
| 12 |
libsm6 \
|
| 13 |
libxext6 \
|
| 14 |
libxrender-dev \
|
| 15 |
+
cuda-runtime-12-4 \
|
| 16 |
+
libcublas-12-4 \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
+
# Create Python 3.10 symlink
|
| 20 |
+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
|
| 21 |
+
|
| 22 |
+
WORKDIR /code
|
| 23 |
+
|
| 24 |
# Copy requirements first for better layer caching
|
| 25 |
COPY requirements.txt .
|
| 26 |
|
| 27 |
+
# Install Python packages with pip upgrade
|
| 28 |
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
| 29 |
pip install --no-cache-dir -r requirements.txt
|
| 30 |
|
|
|
|
| 33 |
# Set environment variables for CUDA
|
| 34 |
ENV CUDA_HOME=/usr/local/cuda
|
| 35 |
ENV PATH=${CUDA_HOME}/bin:${PATH}
|
| 36 |
+
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:/usr/local/cuda-12.4/lib64:${LD_LIBRARY_PATH}
|
| 37 |
ENV INSIGHTFACE_HOME=/tmp/.insightface
|
| 38 |
ENV MPLCONFIGDIR=/tmp/matplotlib
|
| 39 |
|
| 40 |
EXPOSE 7860
|
| 41 |
|
| 42 |
+
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|