mlse-player-3d / Dockerfile
Jake Reardon
Change Python base image to 3.9 for PyTorch 1.13.1 compatibility
2c939b6
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# 1. Install PyTorch first (required by Detectron2)
# Using an older version for compatibility with SAM 3D Body model
RUN pip install --no-cache-dir torch==1.13.1 torchvision==0.14.1
# 2. Install Python dependencies from requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# 3. Install Detectron2 (after PyTorch is installed)
RUN pip install --no-cache-dir 'git+https://github.com/facebookresearch/detectron2.git@a1ce2f9' --no-build-isolation --no-deps
# 4. Install MoGe
RUN pip install --no-cache-dir git+https://github.com/microsoft/MoGe.git
# 5. Clone SAM 3D Body repository (not a standard Python package)
RUN git clone https://github.com/facebookresearch/sam-3d-body.git /app/sam-3d-body
# Copy application code
COPY app/ ./app/
# Create required directories
RUN mkdir -p outputs temp
# Set environment variables
ENV PORT=7860
ENV PYTHONUNBUFFERED=1
# Expose the port
EXPOSE 7860
# Change the working directory to ensure imports work correctly
WORKDIR /app
# Start the application with the correct module path
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]