yolov11n / Dockerfile
monstxr's picture
Update Dockerfile
87967f7 verified
# Base image
FROM python:3.11-slim
# CPU-only environment
ENV TORCH_CUDA_ARCH_LIST=""
ENV CUDA_VISIBLE_DEVICES=""
# System dependencies
RUN apt-get update && apt-get install -y \
git \
ffmpeg \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# Working directory
WORKDIR /app
# Copy requirements
COPY requirements.txt .
# Install CPU PyTorch
RUN pip install --no-cache-dir \
torch==2.1.0 \
torchvision==0.16.0 \
torchaudio==2.1.0 \
--index-url https://download.pytorch.org/whl/cpu
# Fix NumPy 2.x runtime error
RUN pip install --no-cache-dir "numpy<2"
# Install compatible huggingface-hub
RUN pip install --no-cache-dir huggingface-hub>=0.19.3
# Install remaining packages
RUN pip install --no-cache-dir \
git+https://github.com/ultralytics/ultralytics.git@main \
transformers>=4.35.0 \
Pillow \
gradio>=4.41.0 \
opencv-python-headless
# Copy app code
COPY app.py .
# Expose Gradio port
EXPOSE 7860
# Run the app
CMD ["python", "app.py"]