Spaces:
Sleeping
Sleeping
File size: 1,467 Bytes
076810c a348db8 076810c a348db8 076810c a348db8 076810c 94939e1 076810c a348db8 076810c 94939e1 |
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 41 42 43 44 45 46 47 48 49 50 51 52 53 |
FROM nvidia/cuda:12.2.0-runtime-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive
# Install basic system dependencies including software-properties-common
RUN apt-get update && apt-get install -y \
wget \
ca-certificates \
ffmpeg \
libsm6 \
libxext6 \
software-properties-common \
git
RUN apt-get -y install cudnn-cuda-12
# Add the deadsnakes PPA to get Python 3.11 packages
RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update
# Install Python 3.11 and related packages
RUN apt-get install -y \
python3.11 \
python3.11-venv \
python3.11-dev \
python3.11-distutils
# Install pip for Python 3.11 using get-pip.py
RUN wget https://bootstrap.pypa.io/get-pip.py && \
python3.11 get-pip.py && \
rm get-pip.py
# (Optional) Verify pip installation
RUN python3.11 -m pip --version
# Update LD_LIBRARY_PATH to include CUDA/cuDNN libraries
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
# Create and switch to a non-root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy the requirements and install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN python3.11 -m pip install --no-cache-dir --upgrade pip && \
python3.11 -m pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY --chown=user . /app
# Start the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |