foundationpose / Dockerfile
Georg
Optimized Docker build to fix OOM errors
96b4daf
Raw
History Blame
1.16 kB
# Final stage Dockerfile - optimized for HuggingFace
# Uses devel base image (includes CUDA compiler tools)
FROM gpue/foundationpose-base:latest
# FoundationPose configuration
ENV FOUNDATIONPOSE_MODEL_REPO=gpue/foundationpose-weights
ENV USE_REAL_MODEL=true
# Ensure NumPy 1.x for CUDA extension compatibility
RUN pip install --no-cache-dir "numpy<2" transformers \
&& pip install --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py310_cu118_pyt210/download.html
# Set MAX_JOBS=1 BEFORE any CUDA compilation to limit memory usage
ENV MAX_JOBS=1
# Install nvdiffrast (CUDA rasterizer) - needs GPU, build here
RUN pip install --no-cache-dir --no-build-isolation git+https://github.com/NVlabs/nvdiffrast.git
# Build CUDA extensions (requires GPU - only part that needs HuggingFace GPU)
WORKDIR /app/FoundationPose
RUN cd bundlesdf/mycuda && pip install . --no-build-isolation
# Note: mycpp build, weights download, and build deps are already in base image
WORKDIR /app
# Copy application files (placed here so changes don't require base image rebuild)
COPY app.py client.py estimator.py ./
CMD ["python3", "app.py"]