swap / Dockerfile
Antaram's picture
Update Dockerfile
7c7f64c verified
# Use Python 3.11 slim image for smaller size and CPU compatibility
FROM python:3.11-slim
# Set environment variables for Gradio to listen on all interfaces (required for HF Spaces)
ENV GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_SERVER_PORT=7860 \
PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Install uv package manager
RUN pip install --no-cache-dir uv
# Clone the ROOP-FLOYD repository
WORKDIR /app
RUN git clone https://codeberg.org/Cognibuild/ROOP-FLOYD.git .
# Install PyTorch CPU version for maximum compatibility
RUN uv pip install --system --no-cache \
torch torchvision --index-url https://download.pytorch.org/whl/cpu
# Install all required Python packages
RUN uv pip install --system --no-cache \
numpy \
opencv-python-headless \
onnx \
insightface \
albucore \
psutil \
onnxruntime \
tqdm \
ftfy \
regex \
pyvirtualcam
# Install specific versions as required by the application
RUN pip install --no-cache-dir --force-reinstall pydantic==2.10.6
RUN pip install --no-cache-dir gradio==5.13.0
# Expose port 7860 for the Gradio interface
EXPOSE 7860
# Run the application
CMD ["python", "run.py"]