# Alternative Dockerfile with OpenCV compatibility fix FROM python:3.9-bullseye # Install system dependencies first RUN apt-get update && apt-get install -y \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender1 \ libgomp1 \ libgl1-mesa-glx \ libgtk-3-0 \ libavcodec58 \ libavformat58 \ libswscale5 \ libv4l-0 \ libxvidcore4 \ libx264-160 \ libjpeg62-turbo \ libpng16-16 \ libtiff5 \ libatlas-base-dev \ gfortran \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy requirements and install Python packages COPY requirements.txt . # Install OpenCV first with specific version RUN pip install --no-cache-dir opencv-python-headless==4.8.1.78 # Install other dependencies RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy project files COPY . . # Expose port EXPOSE 7860 # Start server CMD ["uvicorn", "inference_server:app", "--host", "0.0.0.0", "--port", "7860"]