Spaces:
Running
Running
# Use Nvidia CUDA runtime as the base image | |
FROM nvidia/cuda:12.6.1-cudnn-runtime-ubuntu24.04 | |
# Set build arguments for repository configuration | |
ARG REPO_URL=https://github.com/rmusser01/tldw.git | |
ARG BRANCH=main | |
ARG GPU_SUPPORT=cpu | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
ffmpeg \ | |
libsqlite3-dev \ | |
build-essential \ | |
git \ | |
python3 \ | |
python3-pyaudio \ | |
portaudio19-dev \ | |
python3-pip \ | |
python3-venv \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create a new user named "user" with user ID 1000 | |
RUN useradd -m -u 1009 user9 | |
# Switch to the "user" user | |
USER user9 | |
# Set environment variables for the user's home directory and PATH | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Set the working directory to the user's app directory | |
WORKDIR $HOME/app | |
# Upgrade pip and install wheel as the non-root user | |
#RUN pip install --no-cache-dir --upgrade pip wheel | |
# Clone the repository into the working directory | |
RUN git clone -b ${BRANCH} ${REPO_URL} . | |
# Create and activate a virtual environment | |
RUN python3 -m venv venv | |
ENV PATH="$HOME/app/venv/bin:$PATH" | |
# Install CUDA libraries | |
RUN pip install --no-cache-dir nvidia-cublas-cu12 nvidia-cudnn-cu12 | |
# Install PyTorch based on GPU support | |
RUN if [ "$GPU_SUPPORT" = "cuda" ]; then \ | |
pip install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu123; \ | |
elif [ "$GPU_SUPPORT" = "amd" ]; then \ | |
pip install torch-directml; \ | |
else \ | |
pip install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cpu; \ | |
fi | |
# Install other Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Update config.txt for CPU if needed | |
RUN if [ "$GPU_SUPPORT" = "cpu" ]; then \ | |
sed -i 's/cuda/cpu/' ./Config_Files/config.txt; \ | |
fi | |
# Expose port 7860 to the outside world | |
EXPOSE 7860 | |
# Set environment variable for Gradio to listen on all interfaces | |
ENV GRADIO_SERVER_NAME="0.0.0.0" | |
# Define the default command to run the application | |
CMD ["python", "summarize.py", "-gui"] | |