File size: 5,661 Bytes
41311e9
 
c0428fb
 
 
 
72e0ec4
c0428fb
 
 
ec84589
a524e91
 
aa091cf
ec84589
791b4cb
a524e91
 
058f698
ec84589
791b4cb
 
52b45a6
56a0440
e3f75d5
064fc60
348cda4
04391b1
b823d0a
e3f75d5
064fc60
ea132cd
b906997
f9dfc58
064fc60
b823d0a
 
 
7677fc6
b7804a4
7677fc6
61eae75
10e139c
 
064fc60
aa091cf
064fc60
 
1b3028b
 
 
c0428fb
 
a01a216
064fc60
 
 
c0428fb
 
ec84589
531a224
a524e91
996461d
477a8e8
5351ee1
e19d1a1
31793a2
21995d9
8c44ee8
bd26fb6
c0428fb
8b8fdfd
59d0e56
8b8fdfd
41311e9
59d0e56
c503f90
41311e9
59d0e56
c503f90
8f9e79a
 
b6ba63d
 
59d0e56
 
41311e9
59d0e56
a1e71b8
 
59d0e56
a1e71b8
 
59d0e56
 
 
a1e71b8
59d0e56
a1e71b8
 
59d0e56
a1e71b8
38b2021
 
59d0e56
0aa91a4
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM debian:bullseye-slim
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
ENV NVIDIA_REQUIRE_CUDA "cuda>=8.0"
ENV LD_LIBRARY_PATH=/usr/local/cuda-11.8/targets/x86_64-linux/lib:/usr/local/cuda-11.8/targets/x86_64-linux/include:/usr/local/cuda/include:/usr/local/cuda-11.8:/usr/local/cuda/lib:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
#RUN dpkg --add-architecture amd64
#RUN apt-get update && \
#    apt-get install -y --no-install-recommends gnupg2 curl ca-certificates
#RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/7fa2af80.pub

# Import the NVIDIA GPG key
RUN apt-get update && apt-get install -y gnupg2 curl
#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
#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 the CUDA repository to sources.list
#RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64 /" | tee /etc/apt/sources.list.d/cuda.list
#USER root
#RUN echo "deb [arch=amd64 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
#RUN gpg --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/7fa2af80.pub
#RUN aptitude install debian-archive-keyring
#RUN apt-get install cuda-archive-keyring
# Fetch the NVIDIA repository GPG key
#RUN curl -fsSL http://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/7fa2af80.pub | gpg --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg

#RUN gpg --import 7fa2af80.pub
# Add the NVIDIA repository and specify the signed-by keyring

#RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] http://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64 /" > /etc/apt/sources.list.d/cuda.list
#RUN apt-get install debian-keyring debian-archive-keyring
#RUN apt-key adv --keyserver keyring.debian.com --recv-keys A4B469963BF863CC
#RUN wget -qO - https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | apt-key add -
#RUN echo "APT::Get::AllowUnauthenticated "true";" | > /etc/apt/apt.conf.d/99-allow-unauthenticated
#RUN echo "deb [arch=amd64 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
#RUN curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/7fa2af80.pub -o 7fa2af80.pub
#RUN gpg --fetch-keys 7fa2af80.pub
#RUN gpg --import 7fa2af80.pub
#RUN gpg --fetch-keys --keyserver keys.gnupg.net F60F4B3D7FA2AF80
#RUN gpg --fetch-keys --keyserver keys.gnupg.net:80
#RUN gpg --recv-keys --keyserver keys.gnupg.net F60F4B3D7FA2AF80
#RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/7fa2af80.pub
#RUN apt-key adv --recv-keys --keyserver keys.gnupg.net F60F4B3D7FA2AF80
# Fetch the 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 the NVIDIA repository to the APT sources list
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub

RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
#RUN gpg --list-sigs [email protected]
#RUN gpg --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/7fa2af80.pub

# Update package lists


#RUN apt-get update
#RUN gpg --delete-key A4B469963BF863CC

#RUN echo "deb https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda.list
#USER root
RUN echo "deb https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64 /" > /etc/apt/sources.list.d/cuda.list

# Install FFmpeg

RUN apt-get update && \
    apt-get install -y python3-pip ffmpeg libcublas-11-8 libcudnn8=8.6.0.163-1+cuda11.8
    #libcudnn8=8.8.0.121-1+cuda11.8



# Use the official Python 3.9 image as the base image
#FROM python:3.9

# Set the working directory to /code
WORKDIR /app

# Copy the requirements file into the container at /code/
COPY ./requirements.txt /app/requirements.txt
# Copy the FastAPI application code into the container
COPY ./app.py /app/app.py
COPY ./interface.html /app/interface.html
COPY ./styles.css /app/styles.css
# Install the required Python packages from requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Create a non-root user (optional but recommended for security)
RUN useradd -m -u 1000 user

# Switch to the non-root user
USER user

# Define environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Change the working directory to /home/user/app
WORKDIR $HOME/app

# Copy the rest of the application files into the container
COPY --chown=user . $HOME/app
# Expose port 80 for the FastAPI application
EXPOSE 7860
# Specify the command to run your application (modify as needed)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]