drewThomasson commited on
Commit
23f9b10
·
verified ·
1 Parent(s): 984b420

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +48 -0
Dockerfile ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Start from a minimal Debian image
2
+ FROM debian:bullseye-slim
3
+
4
+ # Set NVIDIA environment variables
5
+ ENV NVIDIA_VISIBLE_DEVICES all
6
+ ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
7
+ ENV NVIDIA_REQUIRE_CUDA "cuda>=11.8"
8
+ ENV LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH
9
+
10
+ # Update and install required packages
11
+ RUN apt-get update && apt-get install -y \
12
+ gnupg2 curl python3-pip ffmpeg \
13
+ libcublas-11-8 libcudnn8=8.6.0.163-1+cuda11.8
14
+
15
+ # Import NVIDIA repository GPG key
16
+ RUN curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/debian11/x86_64/7fa2af80.pub | \
17
+ gpg --dearmor -o /usr/share/keyrings/cuda-archive-keyring.gpg
18
+
19
+ # Add CUDA repository to sources list
20
+ 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
21
+
22
+ # Update package lists
23
+ RUN apt-get update
24
+
25
+ # Install Python dependencies
26
+ WORKDIR /app
27
+ COPY ./requirements.txt /app/requirements.txt
28
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
29
+
30
+ # Copy application files
31
+ COPY ./app.py /app/app.py
32
+ COPY ./interface.html /app/interface.html
33
+ COPY ./styles.css /app/styles.css
34
+
35
+ # Create a non-root user for security
36
+ RUN useradd -m -u 1000 user
37
+ USER user
38
+
39
+ # Set environment and working directory
40
+ ENV HOME=/home/user
41
+ WORKDIR $HOME/app
42
+
43
+ # Copy remaining files
44
+ COPY --chown=user . $HOME/app
45
+
46
+ # Expose the port and run the application
47
+ EXPOSE 7860
48
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]