vish85521 commited on
Commit
58eb3d4
·
verified ·
1 Parent(s): 747fb82

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -11
Dockerfile CHANGED
@@ -1,29 +1,48 @@
1
- # Use an official PyTorch runtime as a parent image with CUDA support
2
- FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime
3
 
4
- # Set the working directory in the container
5
  WORKDIR /app
6
 
7
- # Install system dependencies necessary for 3D and image processing
8
  RUN apt-get update && apt-get install -y \
9
  git \
 
 
10
  libgl1 \
11
  libglib2.0-0 \
 
 
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Copy requirements file first to leverage Docker layer caching
15
- COPY requirements.txt .
16
 
17
- # Install Python dependencies
 
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  # Create a directory to store generated outputs temporarily
21
  RUN mkdir -p /app/outputs
22
 
23
- # Copy the rest of the application code into the container
24
- COPY . .
25
-
26
- # Hugging Face Spaces requires services to run on port 7860
27
  EXPOSE 7860
28
 
29
  # Command to start the FastAPI application
 
1
+ # Use an official PyTorch image WITH CUDA development headers required for compiling
2
+ FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-devel
3
 
4
+ # Set the working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies for C++/CUDA extensions, 3D processing, and SSH access
8
  RUN apt-get update && apt-get install -y \
9
  git \
10
+ build-essential \
11
+ ninja-build \
12
  libgl1 \
13
  libglib2.0-0 \
14
+ tmate \
15
+ openssh-client \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # Clone the official Hunyuan3D-2 repository
19
+ RUN git clone https://github.com/Tencent/Hunyuan3D-2.git /app/Hunyuan3D-2
20
 
21
+ # Copy your local requirements first
22
+ COPY requirements.txt .
23
  RUN pip install --no-cache-dir -r requirements.txt
24
 
25
+ # Install the base Python requirements from the Tencent repository
26
+ RUN pip install --no-cache-dir -r /app/Hunyuan3D-2/requirements.txt
27
+
28
+ # Compile the Custom Rasterizer (Required for Textures)
29
+ WORKDIR /app/Hunyuan3D-2/hy3dgen/texgen/custom_rasterizer
30
+ RUN python setup.py install
31
+
32
+ # Compile the Differentiable Renderer (Required for Textures)
33
+ WORKDIR /app/Hunyuan3D-2/hy3dgen/texgen/differentiable_renderer
34
+ RUN python setup.py install
35
+
36
+ # Move back to the root app directory
37
+ WORKDIR /app
38
+
39
+ # Copy your API script into the container
40
+ COPY app.py .
41
+
42
  # Create a directory to store generated outputs temporarily
43
  RUN mkdir -p /app/outputs
44
 
45
+ # Expose the default Hugging Face Spaces port
 
 
 
46
  EXPOSE 7860
47
 
48
  # Command to start the FastAPI application