Spaces:
Build error
Build error
Minimal Dockerfile for pre-built image, removed redundant build steps
Browse files- Dockerfile +1 -92
Dockerfile
CHANGED
@@ -17,95 +17,4 @@
|
|
17 |
# FROM nvcr.io/nvidia/pytorch:24.10-py3
|
18 |
|
19 |
# This Dockerfile will simply pull your pre-built image and run it.
|
20 |
-
FROM elungky/gen3c:latest
|
21 |
-
|
22 |
-
# Install basic tools and clean apt cache
|
23 |
-
RUN apt-get update && apt-get install -y git tree ffmpeg wget \
|
24 |
-
&& apt-get clean \
|
25 |
-
&& rm -rf /var/lib/apt/lists/*
|
26 |
-
|
27 |
-
# Create symlinks for bash and libcuda
|
28 |
-
RUN rm /bin/sh && ln -s /bin/bash /bin/sh && ln -s /lib64/libcuda.so.1 /lib64/libcuda.so
|
29 |
-
|
30 |
-
# Set the working directory inside the container
|
31 |
-
WORKDIR /app
|
32 |
-
|
33 |
-
# Copy the cosmos-predict1.yaml and requirements.txt files to the container root
|
34 |
-
COPY ./cosmos-predict1.yaml /cosmos-predict1.yaml
|
35 |
-
COPY ./requirements.txt /requirements.txt
|
36 |
-
|
37 |
-
# Copy all your project files (including gui/, cosmos_predict1/, etc.) into the /app directory.
|
38 |
-
COPY . /app
|
39 |
-
|
40 |
-
# Step 1: Install Miniconda
|
41 |
-
# Install Miniconda to /opt/miniconda3 for consistency
|
42 |
-
RUN echo "Installing Miniconda..." && \
|
43 |
-
mkdir -p /opt/miniconda3 && \
|
44 |
-
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /opt/miniconda3/miniconda.sh && \
|
45 |
-
bash /opt/miniconda3/miniconda.sh -b -u -p /opt/miniconda3 && \
|
46 |
-
rm /opt/miniconda3/miniconda.sh
|
47 |
-
|
48 |
-
# Step 2: Configure Conda and set PATH
|
49 |
-
# Add Miniconda to PATH for current and subsequent RUN commands
|
50 |
-
ENV PATH="/opt/miniconda3/bin:$PATH"
|
51 |
-
RUN echo "Configuring Conda..." && \
|
52 |
-
conda config --set auto_activate_base false && \
|
53 |
-
conda config --set auto_update_conda false && \
|
54 |
-
conda config --set show_channel_urls true && \
|
55 |
-
conda config --set channel_priority strict && \
|
56 |
-
conda config --set safety_checks disabled && \
|
57 |
-
conda config --add channels conda-forge && \
|
58 |
-
conda config --set always_yes true && \
|
59 |
-
conda config --set restore_free_channel true && \
|
60 |
-
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
|
61 |
-
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
|
62 |
-
|
63 |
-
# Step 3: Create the conda environment from the YAML file
|
64 |
-
RUN echo "Creating conda environment from YAML..." && \
|
65 |
-
conda env create --file /cosmos-predict1.yaml
|
66 |
-
|
67 |
-
# Step 4: Activate environment and install core pip requirements
|
68 |
-
# Add the new environment's bin directory to PATH for subsequent `pip` calls
|
69 |
-
ENV PATH="/opt/miniconda3/envs/cosmos-predict1/bin:$PATH"
|
70 |
-
RUN echo "Installing core pip requirements from requirements.txt..." && \
|
71 |
-
pip install --no-cache-dir -r /requirements.txt
|
72 |
-
|
73 |
-
# Step 5: Create necessary symlinks
|
74 |
-
# Use CONDA_PREFIX if set, otherwise fallback to expected path
|
75 |
-
RUN echo "Creating symlinks..." && \
|
76 |
-
ln -sf ${CONDA_PREFIX:-/opt/miniconda3/envs/cosmos-predict1}/lib/python3.10/site-packages/nvidia/*/include/* ${CONDA_PREFIX:-/opt/miniconda3/envs/cosmos-predict1}/include/ && \
|
77 |
-
ln -sf ${CONDA_PREFIX:-/opt/miniconda3/envs/cosmos-predict1}/lib/python3.10/site-packages/nvidia/*/include/* ${CONDA_PREFIX:-/opt/miniconda3/envs/cosmos-predict1}/include/python3.10 && \
|
78 |
-
ln -sf ${CONDA_PREFIX:-/opt/miniconda3/envs/cosmos-predict1}/lib/python3.10/site-packages/triton/backends/nvidia/include/* ${CONDA_PREFIX:-/opt/miniconda3/envs/cosmos-predict1}/include/
|
79 |
-
|
80 |
-
# Step 6: Install specific pip packages
|
81 |
-
RUN echo "Installing specific pip packages..." && \
|
82 |
-
pip install "fastapi[standard]" && \
|
83 |
-
pip install pyexr && \
|
84 |
-
pip install transformer-engine[pytorch]==1.12.0
|
85 |
-
|
86 |
-
# Step 7: Clone and install Apex
|
87 |
-
RUN echo "Cloning and installing Apex..." && \
|
88 |
-
git clone https://github.com/NVIDIA/apex /app/apex_temp && \
|
89 |
-
cd /app/apex_temp && \
|
90 |
-
CUDA_HOME=${CONDA_PREFIX:-/opt/miniconda3/envs/cosmos-predict1} pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" . && \
|
91 |
-
rm -rf /app/apex_temp # Clean up cloned repo after install
|
92 |
-
|
93 |
-
# Step 8: Install MoGe
|
94 |
-
RUN echo "Installing MoGe..." && \
|
95 |
-
pip install git+https://github.com/microsoft/MoGe.git
|
96 |
-
|
97 |
-
# Set environment variables for your application at runtime
|
98 |
-
# Assumes your checkpoints are in /app/checkpoints after COPY . /app
|
99 |
-
ENV GEN3C_CKPT_PATH="/app/checkpoints"
|
100 |
-
# Specify GPU count if your app needs it (e.g., "ALL" for all available)
|
101 |
-
ENV GEN3C_GPU_COUNT="ALL"
|
102 |
-
# Standard path for CUDA_HOME in NVIDIA PyTorch Docker images
|
103 |
-
ENV CUDA_HOME="/usr/local/cuda"
|
104 |
-
|
105 |
-
# Expose the port your FastAPI server will listen on
|
106 |
-
EXPOSE 7860
|
107 |
-
|
108 |
-
# Default command: Activate the conda environment and then run the FastAPI server.
|
109 |
-
# This ensures all your dependencies are available and the server starts correctly.
|
110 |
-
# 'gui.api.server:app' is the correct path for your FastAPI application.
|
111 |
-
CMD ["bash", "-c", "source /opt/miniconda3/bin/activate cosmos-predict1 && uvicorn gui.api.server:app --host 0.0.0.0 --port 7860"]
|
|
|
17 |
# FROM nvcr.io/nvidia/pytorch:24.10-py3
|
18 |
|
19 |
# This Dockerfile will simply pull your pre-built image and run it.
|
20 |
+
FROM elungky/gen3c:latest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|