File size: 1,203 Bytes
be70c20
 
 
 
 
 
 
 
 
a1c932a
 
 
 
 
a3f7958
be70c20
 
 
 
a3f7958
 
 
 
be70c20
a1c932a
 
ef9514e
a1c932a
 
 
ef9514e
 
 
a1c932a
ef9514e
a1c932a
 
ef9514e
 
a1c932a
ef9514e
a1c932a
 
 
 
 
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
# Base image with CUDA 12.2
FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04

# System dependencies
RUN apt-get update -q && \
    apt-get install -y --no-install-recommends \
    python3.9 \
    python3-pip \
    libgl1 \
    libglib2.0-0 \
    wget \
    git \
    && rm -rf /var/lib/apt/lists/*

# CUDA/CuDNN setup with held packages override
RUN wget -qO /tmp/cuda-keyring.deb \
    https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \
    dpkg -i /tmp/cuda-keyring.deb && \
    apt-get update -q && \
    apt-get install -y --allow-change-held-packages --no-install-recommends \
    libcudnn8=8.9.5.29-1+cuda12.2 \
    libcublas-12-2=12.2.5.6-1 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Create directories
RUN mkdir -p /app/{weights,imgs} && \
    chmod -R 777 /app

# Application code
COPY main.py utils.py download_models.py ./

# Download models
RUN python3 download_models.py

# Set up user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]