File size: 1,177 Bytes
736a246
b29b354
736a246
4f004a4
736a246
 
 
54c35a0
450be20
bf9bd7f
 
 
736a246
 
5ad643a
caf6800
5ad643a
caf6800
54c35a0
caf6800
 
906fc1d
caf6800
54c35a0
 
8274e24
 
 
caf6800
 
 
 
736a246
 
 
906fc1d
739c26a
54c35a0
 
5ad643a
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
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04

# Install Python and system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3.10 \
    python3.10-dev \
    python3-pip \
    build-essential \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    && rm -rf /var/lib/apt/lists/* && \
    update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1

WORKDIR /app

# Copy and install requirements
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY . .

# Copy static ai-images (baked into container for fast local access)
RUN if [ -d "ai-images" ]; then echo "ai-images directory found"; else echo "WARNING: ai-images directory not found"; fi

# Create insightface cache directory
RUN mkdir -p /tmp/.insightface

# Set environment variables
ENV CUDA_HOME=/usr/local/cuda
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
ENV PATH=${CUDA_HOME}/bin:${PATH}
ENV INSIGHTFACE_HOME=/tmp/.insightface

EXPOSE 7860

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