File size: 1,528 Bytes
23f9b10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Start from a minimal Debian image
FROM debian:bullseye-slim

# Set NVIDIA environment variables
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
ENV NVIDIA_REQUIRE_CUDA "cuda>=11.8"
ENV LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH

# Update and install required packages
RUN apt-get update && apt-get install -y \
    gnupg2 curl python3-pip ffmpeg \
    libcublas-11-8 libcudnn8=8.6.0.163-1+cuda11.8

# Import NVIDIA repository GPG key
RUN curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/7fa2af80.pub | \
    gpg --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg

# Add CUDA repository to sources list
RUN echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64 /" > /etc/apt/sources.list.d/cuda.list

# Update package lists
RUN apt-get update

# Install Python dependencies
WORKDIR /app
COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy application files
COPY ./app.py /app/app.py
COPY ./interface.html /app/interface.html
COPY ./styles.css /app/styles.css

# Create a non-root user for security
RUN useradd -m -u 1000 user
USER user

# Set environment and working directory
ENV HOME=/home/user
WORKDIR $HOME/app

# Copy remaining files
COPY --chown=user . $HOME/app

# Expose the port and run the application
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]