FROM python:3.10-slim # Install system dependencies RUN apt-get update && apt-get install -y \ git \ ffmpeg \ libsm6 \ libxext6 \ g++ \ build-essential \ libgl1 \ libglib2.0-0 \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy only requirements first to leverage Docker caching COPY requirements.txt ./ # Install PyTorch (CPU version) RUN pip install --no-cache-dir torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 # Install OpenMMLab dependencies RUN pip install --no-cache-dir mmengine mmcv-full openmim # Install MMSegmentation using mim AFTER torch is present RUN mim install mmsegmentation # Copy rest of the application code COPY . . # Install remaining Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Expose Gradio port EXPOSE 7860 # Start the app CMD ["python", "app.py"]