-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
135 lines (115 loc) · 4.92 KB
/
Dockerfile
File metadata and controls
135 lines (115 loc) · 4.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
FROM ros:humble-ros-base
ENV DEBIAN_FRONTEND=noninteractive
ENV SHELL=/bin/bash
ENV EDITOR=vim
ENV VISUAL=vim
# 1) base system deps (all in one layer)
RUN apt-get update && \
apt-get install -y \
git \
git-lfs \
can-utils \
net-tools \
iproute2 \
udev \
sudo \
python3 \
python3-pip \
nano \
vim \
libboost-all-dev \
liburdfdom-dev \
liburdfdom-headers-dev \
libeigen3-dev \
liborocos-kdl-dev \
libnlopt-dev \
libnlopt-cxx-dev \
software-properties-common \
build-essential \
procps \
curl \
file \
rsync \
ca-certificates \
lsof \
usbutils \
unzip \
&& rm -rf /var/lib/apt/lists/* && \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip" && \
unzip /tmp/awscliv2.zip -d /tmp && \
/tmp/aws/install && \
rm -rf /tmp/awscliv2.zip /tmp/aws
RUN git config --global core.editor vim
WORKDIR /home/robot
# 2) micromamba (separate so it stays cached)
RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest \
| tar -xvj -C /usr/local/bin/ --strip-components=1 bin/micromamba
# 3) install newer git + Homebrew + graphite (kept together)
RUN add-apt-repository ppa:git-core/ppa -y && \
apt-get update && \
apt-get install -y git && \
rm -rf /var/lib/apt/lists/* && \
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && \
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /root/.bashrc && \
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" && \
brew update && \
brew tap withgraphite/tap && \
brew install withgraphite/tap/graphite && \
gt auth --token SX4r5gXXW83uNr4x1USeYFcc2VUEzp5YfBOGJVP7xXiGUk4vhEYEnPObeTY8
# 4) create workspace dir early
RUN mkdir -p /home/robot/robot_ws
WORKDIR /home/robot/robot_ws
# 5) copy only the env + requirements first (so pip/mamba stays cached)
# adjust paths below to match your repo layout on host
COPY egomimic/robot/eva/stanford_repo/conda_environments/py310_environment.yaml /tmp/py310_environment.yaml
COPY requirements.txt /tmp/requirements.txt
# 6) create mamba env (its own layer)
RUN micromamba create -y -f /tmp/py310_environment.yaml -n arx-py310 && \
micromamba clean --all --yes
# 7) build stanford_repo inside the env
SHELL ["micromamba", "run", "-n", "arx-py310", "/bin/bash", "-c"]
WORKDIR /home/robot/robot_ws
# we need the source to build, so copy now
COPY . /home/robot/robot_ws
WORKDIR /home/robot/robot_ws/egomimic/robot/eva/stanford_repo
RUN mkdir -p build && \
cd build && \
cmake .. -DCMAKE_PREFIX_PATH=/opt/ros/humble -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ && \
make -j
# 8) install arx5 python binding into ROS python
WORKDIR /home/robot/robot_ws/egomimic/robot/eva/stanford_repo/python
RUN mkdir -p /opt/ros/humble/lib/python3.10/site-packages/arx5 && \
cp arx5_interface.cpython-310-x86_64-linux-gnu.so \
/opt/ros/humble/lib/python3.10/site-packages/arx5/arx5_interface.cpython-310-x86_64-linux-gnu.so
# 9) back to normal shell
SHELL ["/bin/bash", "-c"]
# 10) ROS + handy aliases
RUN echo 'source /opt/ros/humble/setup.bash' >> /root/.bashrc && \
echo 'alias wsbuild="cd /home/robot/robot_ws/egomimic/robot/eva/eva_ws && colcon build && source /opt/ros/humble/setup.bash && source install/setup.bash && export LD_LIBRARY_PATH=/root/.local/share/mamba/envs/arx-py310/lib:$LD_LIBRARY_PATH"' >> /root/.bashrc && \
echo 'alias sf_build="micromamba run -n arx-py310 bash -c \"cd /home/robot/robot_ws/egomimic/robot/eva/stanford_repo && rm -rf build && mkdir -p build && cd build && cmake .. -DCMAKE_PREFIX_PATH=/opt/ros/humble -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ && make -j && cd ../python && mkdir -p /opt/ros/humble/lib/python3.10/site-packages/arx5 && cp arx5_interface.cpython-*.so /opt/ros/humble/lib/python3.10/site-packages/arx5/arx5_interface.cpython-310-x86_64-linux-gnu.so\""' >> /root/.bashrc && \
echo 'alias rhome="cd /home/robot/robot_ws/egomimic/robot"' >> /root/.bashrc && \
echo 'cd /home/robot/robot_ws' >> /root/.bashrc
WORKDIR /home/robot/robot_ws
# 11) python deps (outside mamba, your original flow)
RUN pip install -r /tmp/requirements.txt && \
pip install -e . && \
pip install -e egomimic/robot/oculus_reader/. && \
pip install pybullet pybind11 h5py
# 13) camera / GUI libs + realsense (once)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libusb-1.0-0 \
libegl1 \
libegl1-mesa && \
rm -rf /var/lib/apt/lists/* && \
pip install projectaria_client_sdk==1.1.0 && \
pip uninstall -y numpy opencv-python opencv-contrib-python opencv-python-headless && \
pip install --no-cache-dir numpy opencv-python-headless && \
pip install pyrealsense2
WORKDIR /home/robot/robot_ws
ENTRYPOINT ["/bin/bash"]