Georg commited on
Commit
9f36f2f
·
1 Parent(s): e317b3c

Optimized Docker build to fix OOM errors

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -6
  2. Dockerfile.base +2 -2
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # Final stage Dockerfile - optimized for HuggingFace
2
- # Uses runtime base image (not devel) with minimal dependencies
3
  FROM gpue/foundationpose-base:latest
4
 
5
  # FoundationPose configuration
@@ -9,14 +9,12 @@ ENV USE_REAL_MODEL=true
9
  # Downgrade NumPy to 1.x for CUDA extension compatibility
10
  RUN pip install --no-cache-dir "numpy<2"
11
 
12
- # Install CUDA compiler and build tools temporarily
13
  RUN apt-get update && apt-get install -y --no-install-recommends \
14
  cmake \
15
  build-essential \
16
  ninja-build \
17
  libeigen3-dev \
18
- cuda-compiler-11-8 \
19
- cuda-nvcc-11-8 \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
  # Build FoundationPose C++ extensions (requires GPU)
@@ -24,8 +22,8 @@ WORKDIR /app/FoundationPose
24
  RUN cd bundlesdf/mycuda && pip install . --no-build-isolation
25
  RUN cd mycpp && python setup.py build_ext --inplace
26
 
27
- # Remove build tools to save space
28
- RUN apt-get purge -y cmake build-essential ninja-build libeigen3-dev cuda-compiler-11-8 cuda-nvcc-11-8 && \
29
  apt-get autoremove -y && \
30
  apt-get clean && \
31
  rm -rf /var/lib/apt/lists/*
 
1
  # Final stage Dockerfile - optimized for HuggingFace
2
+ # Uses devel base image (includes CUDA compiler tools)
3
  FROM gpue/foundationpose-base:latest
4
 
5
  # FoundationPose configuration
 
9
  # Downgrade NumPy to 1.x for CUDA extension compatibility
10
  RUN pip install --no-cache-dir "numpy<2"
11
 
12
+ # Install build tools temporarily (CUDA compiler already in devel base)
13
  RUN apt-get update && apt-get install -y --no-install-recommends \
14
  cmake \
15
  build-essential \
16
  ninja-build \
17
  libeigen3-dev \
 
 
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
  # Build FoundationPose C++ extensions (requires GPU)
 
22
  RUN cd bundlesdf/mycuda && pip install . --no-build-isolation
23
  RUN cd mycpp && python setup.py build_ext --inplace
24
 
25
+ # Remove build tools to save space (keep CUDA compiler)
26
+ RUN apt-get purge -y cmake ninja-build libeigen3-dev && \
27
  apt-get autoremove -y && \
28
  apt-get clean && \
29
  rm -rf /var/lib/apt/lists/*
Dockerfile.base CHANGED
@@ -1,5 +1,5 @@
1
- # Minimal base image - optimized for size and build speed
2
- FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
3
 
4
  ENV DEBIAN_FRONTEND=noninteractive
5
  ENV CUDA_HOME=/usr/local/cuda
 
1
+ # Base image with CUDA compiler tools (needed for C++ extensions)
2
+ FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
3
 
4
  ENV DEBIAN_FRONTEND=noninteractive
5
  ENV CUDA_HOME=/usr/local/cuda