Skip to content

Commit 85e4d0e

Browse files
committed
feat: unify install script & use install script for docker
Signed-off-by: Hao Lin <linhaomails@gmail.com>
1 parent 5ce3aa2 commit 85e4d0e

File tree

13 files changed

+385
-439
lines changed

13 files changed

+385
-439
lines changed

.github/workflows/ci-tests.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,10 @@ jobs:
5050
- 'tests/**'
5151
- '.github/workflows/*tests.yml'
5252
- '*.yaml'
53-
install_filter:
54-
- 'pyproject.toml'
55-
- 'requirements/*.sh'
56-
- 'requirements/*.txt'
57-
- '.github/workflows/install.yml'
5853
docker_filter:
5954
- 'docker/torch*/**'
6055
- '.github/workflows/docker-build.yml'
6156
62-
63-
# =============================================== install tests ====================================================
64-
65-
install-tests:
66-
needs: [check-changes]
67-
if: needs.check-changes.outputs.install_filter == 'true'
68-
uses: ./.github/workflows/install.yml
69-
7057
# =============================================== docker tests ====================================================
7158

7259
docker-tests:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ __pycache__
44
*.idx
55
*.npy
66
*.txt
7-
!requirements/*
7+
!requirements/**
88
!docs/*
99
*.DS_Store
1010
*.out

docker/Dockerfile

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
ARG BUILD_TARGET=reason
2+
3+
FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 AS base-image
4+
5+
ARG NO_MIRROR
6+
SHELL ["/bin/bash", "-c"]
7+
ENV PATH=/opt/conda/bin:$PATH
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
RUN if [ -z "$NO_MIRROR" ]; then sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list; fi
10+
RUN apt-get update && apt-get install -y --no-install-recommends \
11+
git vim libibverbs-dev openssh-server sudo runit runit-systemd tmux \
12+
build-essential python3-dev cmake pkg-config iproute2 pciutils python3 python3-pip \
13+
wget unzip curl
14+
15+
RUN pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
16+
RUN python3 -m pip install -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple --upgrade pip setuptools wheel uv
17+
18+
ENV HF_HOME=/opt/.cache/huggingface
19+
RUN mkdir -p $HF_HOME
20+
21+
# UV setup
22+
ENV UV_DEFAULT_INDEX=${NO_MIRROR:+"https://pypi.org/simple/"}
23+
ENV UV_DEFAULT_INDEX=${UV_DEFAULT_INDEX:-"https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"}
24+
ENV UV_PATH=/opt/venv
25+
RUN mkdir $UV_PATH
26+
WORKDIR $UV_PATH
27+
ENV UV_LINK_MODE=symlink
28+
ENV UV_CACHE_DIR=$UV_PATH/.cache
29+
ENV UV_PYTHON_INSTALL_DIR=${UV_PATH}/.python
30+
31+
# Requirements
32+
COPY ../pyproject.toml $UV_PATH/pyproject.toml
33+
COPY ../requirements $UV_PATH/requirements
34+
35+
# switch_env utility
36+
RUN cat <<EOF > /usr/local/bin/switch_env
37+
#!/bin/bash
38+
if [ -z "\$1" ]; then
39+
echo "Usage: switch_env <env_name>"
40+
exit 1
41+
fi
42+
if [ ! -d "${UV_PATH}/\$1" ]; then
43+
echo "Environment \$1 does not exist in ${UV_PATH}."
44+
exit 1
45+
fi
46+
source ${UV_PATH}/\$1/bin/activate
47+
EOF
48+
RUN chmod +x /usr/local/bin/switch_env
49+
50+
FROM base-image AS reason-image
51+
52+
RUN bash requirements/install.sh reason --venv reason
53+
54+
# Set default env
55+
RUN echo "source ${UV_PATH}/reason/bin/activate" >> ~/.bashrc
56+
57+
FROM base-image AS embodied-common-image
58+
59+
# Embodied NVIDIA_DRIVER_CAPABILITIES
60+
ENV NVIDIA_DRIVER_CAPABILITIES="all"
61+
62+
# link_assets utility
63+
RUN cat <<EOF > /usr/local/bin/link_assets
64+
#!/bin/bash
65+
if [ -d /opt/.maniskill ]; then
66+
ln -s /opt/.maniskill ~/.maniskill
67+
fi
68+
if [ -d /opt/.sapien ]; then
69+
ln -s /opt/.sapien ~/.sapien
70+
fi
71+
mkdir -p ~/.cache
72+
if [ -d /opt/.openpi ]; then
73+
ln -s /opt/.openpi ~/.cache/openpi
74+
fi
75+
EOF
76+
RUN chmod +x /usr/local/bin/link_assets
77+
78+
# download_assets utility
79+
RUN cat <<EOF > /usr/local/bin/download_assets
80+
#!/bin/bash
81+
82+
# Download assets for ManiSkill
83+
export MS_ASSET_DIR=/opt/.maniskill
84+
python -m mani_skill.utils.download_asset bridge_v2_real2sim -y
85+
python -m mani_skill.utils.download_asset widowx250s -y
86+
87+
# Download assets for SAPIEN
88+
export PHYSX_VERSION=105.1-physx-5.3.1.patch0
89+
export PHYSX_DIR=/opt/.sapien/physx/\$PHYSX_VERSION
90+
mkdir -p \$PHYSX_DIR
91+
wget -O \$PHYSX_DIR/linux-so.zip https://github.com/sapien-sim/physx-precompiled/releases/download/\$PHYSX_VERSION/linux-so.zip
92+
unzip \$PHYSX_DIR/linux-so.zip -d \$PHYSX_DIR && rm \$PHYSX_DIR/linux-so.zip
93+
94+
# Download assets for OpenPI
95+
export TOKENIZER_DIR=/opt/.openpi/big_vision/
96+
mkdir -p \$TOKENIZER_DIR && gsutil -m cp -r gs://big_vision/paligemma_tokenizer.model \$TOKENIZER_DIR
97+
EOF
98+
RUN chmod +x /usr/local/bin/download_assets
99+
100+
FROM embodied-common-image AS embodied-image
101+
102+
# Install openvla env
103+
RUN requirements/install.sh embodied --venv openvla --model openvla --env maniskill_libero
104+
105+
# Install openvla-oft env
106+
RUN requirements/install.sh embodied --venv openvla-oft --model openvla-oft --env maniskill_libero
107+
108+
# Install openpi env
109+
RUN requirements/install.sh embodied --venv openpi --model openpi --env maniskill_libero
110+
111+
RUN source switch_env openvla && download_assets
112+
RUN link_assets
113+
114+
# Set default env
115+
RUN echo "source ${UV_PATH}/openvla/bin/activate" >> ~/.bashrc
116+
117+
FROM embodied-common-image AS embodied-behavior-image
118+
119+
# Install openvla-oft env
120+
RUN bash requirements/install.sh embodied --venv openvla-oft --model openvla-oft --env behavior
121+
# omnigibson downloads assets to /tmp during initialization
122+
RUN source switch_env openvla-oft && python -c "import omnigibson as og; cfg={}; og.Environment(cfg); og.shutdown()" || exit 0
123+
124+
RUN source switch_env openvla-oft && download_assets
125+
RUN link_assets
126+
127+
# Set default env
128+
RUN echo "source ${UV_PATH}/${VENV_TARGET}/bin/activate" >> ~/.bashrc
129+
130+
FROM ${BUILD_TARGET}-image AS final-image
131+
132+
# Clean up
133+
RUN uv cache prune
134+
RUN rm -rf /var/lib/apt/lists/*
135+
136+
WORKDIR /workspace
137+
138+
CMD ["/bin/bash"]

docker/torch-2.6/Dockerfile

Lines changed: 0 additions & 222 deletions
This file was deleted.

0 commit comments

Comments
 (0)