File size: 2,134 Bytes
9586789
0dcbd33
 
9586789
0dcbd33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9586789
120907a
0dcbd33
9586789
120907a
0dcbd33
9586789
 
 
0dcbd33
9586789
 
0dcbd33
9586789
b88af60
0dcbd33
9586789
 
 
 
 
ed8b453
0dcbd33
9586789
 
0dcbd33
 
 
 
 
 
 
 
 
 
9586789
 
0dcbd33
 
 
 
 
 
9586789
0dcbd33
 
9586789
0dcbd33
 
9586789
 
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 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"]