roll-ai commited on
Commit
2dbe65c
·
verified ·
1 Parent(s): 46aba71

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +48 -19
Dockerfile CHANGED
@@ -1,26 +1,55 @@
1
- # SPDX-License-IdentifierText: NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
- FROM nvcr.io/nvidia/pytorch:24.10-py3
3
 
4
- # Install system tools
5
- RUN apt-get update && apt-get install -y git tree ffmpeg wget build-essential && rm -rf /var/lib/apt/lists/*
 
 
6
 
7
- # Set working directory
8
- WORKDIR /app
 
 
9
 
10
- # Copy environment and app files
11
- COPY ./cosmos-predict1.yaml /cosmos-predict1.yaml
12
- COPY ./requirements.txt /requirements.txt
13
- COPY ./setup.sh /setup.sh
14
- COPY . /app
15
 
16
- # Give permission to setup script
17
- RUN chmod +x /setup.sh
 
18
 
19
- # Run setup script as root
20
- RUN /bin/bash /setup.sh
 
21
 
22
- # Expose Gradio port
23
- EXPOSE 7860
24
 
25
- # Default command
26
- CMD ["python", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Ubuntu + CUDA base image for full GPU support
2
+ FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
3
 
4
+ # Set environment variables
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ ENV PATH=/root/miniconda3/bin:$PATH
7
+ ENV CONDA_ENV_NAME=cosmos-predict1
8
 
9
+ # Install dependencies
10
+ RUN apt-get update && apt-get install -y \
11
+ git curl wget sudo build-essential ca-certificates libglib2.0-0 libsm6 libxext6 libxrender-dev \
12
+ && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Install Miniconda
15
+ RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && \
16
+ bash miniconda.sh -b -p /root/miniconda3 && \
17
+ rm miniconda.sh && \
18
+ conda clean -ya
19
 
20
+ # Copy project files
21
+ WORKDIR /workspace
22
+ COPY . .
23
 
24
+ # Create and activate conda environment
25
+ RUN conda env create -f cosmos-predict1.yaml && \
26
+ echo "conda activate cosmos-predict1" >> ~/.bashrc
27
 
28
+ # Activate env and install Python packages
29
+ SHELL ["conda", "run", "-n", "cosmos-predict1", "/bin/bash", "-c"]
30
 
31
+ # Install remaining pip requirements
32
+ RUN pip install -r requirements.txt
33
+
34
+ # Patch Transformer Engine headers
35
+ RUN ln -sf $CONDA_PREFIX/lib/python3.10/site-packages/nvidia/*/include/* $CONDA_PREFIX/include/ && \
36
+ ln -sf $CONDA_PREFIX/lib/python3.10/site-packages/nvidia/*/include/* $CONDA_PREFIX/include/python3.10
37
+
38
+ # Install Transformer Engine
39
+ RUN pip install transformer-engine[pytorch]==1.12.0
40
+
41
+ # Install Apex
42
+ RUN git clone https://github.com/NVIDIA/apex && \
43
+ CUDA_HOME=$CONDA_PREFIX pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation \
44
+ --config-settings "--build-option=--cpp_ext" \
45
+ --config-settings "--build-option=--cuda_ext" \
46
+ ./apex
47
+
48
+ # Install MoGe
49
+ RUN pip install git+https://github.com/microsoft/MoGe.git
50
+
51
+ # (Optional) Test the environment
52
+ RUN CUDA_HOME=$CONDA_PREFIX PYTHONPATH=$(pwd) python scripts/test_environment.py
53
+
54
+ # Set the command to run app (replace with your app script or gradio interface)
55
+ CMD ["conda", "run", "--no-capture-output", "-n", "cosmos-predict1", "python", "app.py"]