banao-tech commited on
Commit
91ae803
·
verified ·
1 Parent(s): 6e5ba47

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -25
Dockerfile CHANGED
@@ -1,33 +1,17 @@
1
  # Use NVIDIA CUDA base image with Ubuntu 22.04, CUDA 12.2, and cuDNN 8
2
  FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04
3
 
4
- # Set Python to run in unbuffered mode for better logging
5
- ENV PYTHONUNBUFFERED=1
6
 
7
- # Install Python and system dependencies in a single layer
8
- RUN apt-get update && apt-get install -y --no-install-recommends \
9
- python3.10 \
10
- python3-pip \
11
- libgl1 \
12
- libglib2.0-0 \
13
- libsm6 \
14
- libxext6 \
15
- libxrender-dev \
16
- && ln -s /usr/bin/python3.10 /usr/bin/python \
17
- && rm -rf /var/lib/apt/lists/*
18
 
19
- # Copy and install Python requirements
20
- COPY requirements.txt .
21
- RUN pip install --no-cache-dir -r requirements.txt
22
 
23
- # Copy application code
24
- COPY main.py utils.py ./
25
 
26
- # Verify the application can be imported without errors
27
- RUN python -c "from main import app"
28
-
29
- # Expose the application port
30
- EXPOSE 7860
31
-
32
- # Start the FastAPI server
33
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Use NVIDIA CUDA base image with Ubuntu 22.04, CUDA 12.2, and cuDNN 8
2
  FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04
3
 
4
+ USER root
 
5
 
6
+ RUN chmod 1777 /tmp \
7
+ && apt update -q && apt install -y ca-certificates wget libgl1 \
8
+ && wget -qO /tmp/cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \
9
+ && dpkg -i /tmp/cuda-keyring.deb && apt update -q \
10
+ && apt install -y --no-install-recommends libcudnn8 libcublas-12-2
 
 
 
 
 
 
11
 
12
+ RUN pip install fastapi[all]
 
 
13
 
 
 
14
 
15
+ COPY main.py main.py
16
+ RUN python main.py
 
 
 
 
 
17
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]