FaceMatch-Azure-Dev / Dockerfile
ashutosh-koottu's picture
Pre-warm plus 24 hour embeddings caching
736a246
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"]