Update Dockerfile
Browse files- Dockerfile +30 -11
Dockerfile
CHANGED
|
@@ -1,29 +1,48 @@
|
|
| 1 |
-
# Use an official PyTorch
|
| 2 |
-
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Install system dependencies
|
| 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 |
-
#
|
| 15 |
-
|
| 16 |
|
| 17 |
-
#
|
|
|
|
| 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 |
-
#
|
| 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
|