-
Notifications
You must be signed in to change notification settings - Fork 0
/
JetsonDockerfile
184 lines (149 loc) · 6.21 KB
/
JetsonDockerfile
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
FROM uavf_2024_ros_base:l4t-r35.4.1 as main-setup
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install --no-install-recommends -y \
lsb-release \
sudo \
wget \
software-properties-common \
build-essential \
ccache \
g++ \
gdb \
gawk \
git \
make \
cmake \
ninja-build \
libtool \
libxml2-dev \
libxslt1-dev \
python3-numpy \
python3-pyparsing \
python3-serial \
python-is-python3 \
libpython3-stdlib \
libtool-bin \
zip \
default-jre \
socat \
ros-dev-tools \
&& apt-get clean \
&& apt-get -y autoremove \
&& apt-get autoclean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# TAKEN from https://github.com/docker-library/python/blob/a58630aef106c8efd710011c6a2a0a1d551319a0/3.11/bullseye/Dockerfile
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 23.1.2
# https://github.com/docker-library/python/issues/365
ENV PYTHON_SETUPTOOLS_VERSION 65.5.1
# https://github.com/pypa/get-pip
ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/9af82b715db434abb94a0a6f3569f43e72157346/public/get-pip.py
ENV PYTHON_GET_PIP_SHA256 45a2bb8bf2bb5eff16fdd00faef6f29731831c7c59bd9fc2bf1f3bed511ff1fe
RUN set -eux; \
\
wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \
echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \
\
export PYTHONDONTWRITEBYTECODE=1; \
\
python get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
--no-compile \
"pip==$PYTHON_PIP_VERSION" \
"setuptools==$PYTHON_SETUPTOOLS_VERSION" \
; \
rm -f get-pip.py; \
\
pip --version
RUN python -m pip install --no-cache-dir -U future lxml pexpect flake8 pyelftools tabulate pymavlink pre-commit
FROM eclipse-temurin:19-jdk-jammy as dds-gen-builder
RUN apt-get update && apt-get install --no-install-recommends -y \
git \
&& apt-get clean \
&& apt-get -y autoremove \
&& apt-get autoclean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN git clone -b develop --recurse-submodules https://github.com/ArduPilot/Micro-XRCE-DDS-Gen.git --depth 1 --no-single-branch --branch develop dds-gen \
&& cd dds-gen \
&& ./gradlew assemble
FROM main-setup
WORKDIR /dds-gen
COPY --from=dds-gen-builder /dds-gen/scripts scripts/
COPY --from=dds-gen-builder /dds-gen/share share/
WORKDIR /
# Get STM32 GCC10 toolchain
ARG ARM_ROOT="gcc-arm-none-eabi-10"
ARG ARM_ROOT_EXT="-2020-q4-major"
ARG ARM_TARBALL="$ARM_ROOT$ARM_ROOT_EXT-x86_64-linux.tar.bz2"
ARG ARM_TARBALL_URL="https://firmware.ardupilot.org/Tools/STM32-tools/$ARM_TARBALL"
RUN cd /opt \
&& wget -qO- "$ARM_TARBALL_URL" | tar jx \
&& mv "/opt/$ARM_ROOT$ARM_ROOT_EXT" "/opt/$ARM_ROOT" \
&& rm -rf "/opt/$ARM_ROOT/share/doc"
# manual ccache setup for arm-none-eabi-g++/arm-none-eabi-gcc
RUN ln -s /usr/bin/ccache /usr/lib/ccache/arm-none-eabi-g++ \
&& ln -s /usr/bin/ccache /usr/lib/ccache/arm-none-eabi-gcc
# Set STM32 toolchain to the PATH
ENV PATH="/opt/$ARM_ROOT/bin:$PATH"
RUN mkdir -p $HOME/arm-gcc \
&& ln -s -f /opt/gcc-arm-none-eabi-10/ g++-10.2.1
ENV PATH="/dds-gen/scripts:$PATH"
# Set ccache to the PATH
ENV PATH="/usr/lib/ccache:$PATH"
# Gain some time by disabling mavnative
ENV DISABLE_MAVNATIVE=True
# Set the buildlogs directory into /tmp as other directory aren't accessible
ENV BUILDLOGS=/tmp/buildlogs
ENV TZ=UTC
#-------------------------------------
# EVERYTHING BELOW THIS LINE IS EDITABLE
#-------------------------------------
RUN apt update
RUN apt-get update --fix-missing
RUN apt-get install -y python3-pip
RUN apt-get install -y ffmpeg libsm6 libxext6
WORKDIR "/home/ws/uavf_2024"
COPY setup.py setup.py
RUN pip install -e .
# GNC setup stuff (gazebo garden, ardupilot sitl, and respective ros2 plugins etc)
RUN apt-get install -y tmux vim
RUN apt-get install -y default-jre socat ros-humble-geographic-msgs ros-dev-tools
WORKDIR /root/ros2_ws/src
RUN wget https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/ros2/ros2.repos
RUN vcs import --recursive < ros2.repos
RUN wget https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/ros2_gz.repos
RUN vcs import --recursive < ros2_gz.repos
# env so now its persistant for future colcon builds
ENV GZ_VERSION=garden
RUN apt-get -y install lsb-release wget gnupg
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
RUN apt-get update
RUN apt-get -y install gz-garden
WORKDIR /root/ros2_ws
RUN apt update
RUN rosdep update
RUN rosdep install --rosdistro ${ROS_DISTRO} --from-paths src -i -r -y
# we dont need the extra args here
RUN bash -c "source /opt/ros/humble/setup.bash && colcon build"
# Unfortunately this is not persistant in docker so you need to source them during runtime with the CMD at the end
#RUN echo 'source /opt/ros/humble/setup.bash' >> /root/.bashrc
#RUN echo 'source /root/ros2_ws/install/setup.bash' >> /root/.bashrc
#RUN echo 'export PATH=/root/ros2_ws/src/ardupilot/Tools/autotest:$PATH' >> /root/.bashrc
#RUN echo 'export PATH=/usr/lib/ccache:$PATH' >> /root/.bashrc
RUN sudo apt-get install -y python3-dev python3-wxgtk4.0 python3-pip python3-matplotlib python3-lxml python3-pygame
RUN pip3 install PyYAML mavproxy --user
#RUN echo 'export PATH="$PATH:$HOME/.local/bin"' >> /root/.bashrc
RUN cp src/ardupilot/Tools/vagrant/mavinit.scr /root/.mavinit.scr
#since apt installs the specific version we want we uninstall the pip version
RUN python -m pip uninstall matplotlib -y
RUN sudo apt-get install -y ros-humble-mavros ros-humble-mavros-extras
RUN bash -ic "source /opt/ros/humble/setup.bash && ros2 run mavros install_geographiclib_datasets.sh"
# you are troll... >.>
COPY .devcontainer/bashrc_setup.sh /usr/local/bin/bashrc_setup.sh
RUN chmod 777 /usr/local/bin/bashrc_setup.sh
RUN bash /usr/local/bin/bashrc_setup.sh
RUN pip install opencv-python==4.5.5.64
RUN echo "export LD_LIBRARY_PATH=/usr/local/lib/python3.8/dist-packages-opencv_python.libs/:\$LD_LIBRARY_PATH" >> ~/.bashrc
CMD ["/bin/bash"]