Skip to content

Commit

Permalink
Add image for ROS2 developpements
Browse files Browse the repository at this point in the history
  • Loading branch information
khancyr committed Apr 6, 2023
1 parent 654ae0e commit b20cbba
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/build_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ jobs:
armhf,
aarch64,
coverage,
chibios-py2
chibios-py2,
ros
]
steps:
# git checkout the PR
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Each image is specialized to contain only the necessary tools to build the relat
- [ardupilot/ardupilot-dev-aarch64](https://hub.docker.com/r/ardupilot/ardupilot-dev-aarch64) [![](https://images.microbadger.com/badges/image/ardupilot/ardupilot-dev-aarch64.svg)](http://microbadger.com/images/ardupilot/ardupilot-dev-aarch64) [![Docker Size](https://img.shields.io/docker/image-size/ardupilot/ardupilot-dev-aarch64/latest)](https://hub.docker.com/r/ardupilot/ardupilot-dev-aarch64) [![Docker Pulls](https://img.shields.io/docker/pulls/ardupilot/ardupilot-dev-aarch64.svg)](https://hub.docker.com/r/ardupilot/ardupilot-dev-aarch64)
- [ardupilot/ardupilot-dev-coverage](https://hub.docker.com/r/ardupilot/ardupilot-dev-coverage) [![](https://images.microbadger.com/badges/image/ardupilot/ardupilot-dev-coverage.svg)](http://microbadger.com/images/ardupilot/ardupilot-dev-coverage) [![Docker Size](https://img.shields.io/docker/image-size/ardupilot/ardupilot-dev-coverage/latest)](https://hub.docker.com/r/ardupilot/ardupilot-dev-coverage) [![Docker Pulls](https://img.shields.io/docker/pulls/ardupilot/ardupilot-dev-coverage.svg)](https://hub.docker.com/r/ardupilot/ardupilot-dev-coverage)
- [ardupilot/ardupilot-dev-periph](https://hub.docker.com/r/ardupilot/ardupilot-dev-periph) [![](https://images.microbadger.com/badges/image/ardupilot/ardupilot-dev-periph.svg)](http://microbadger.com/images/ardupilot/ardupilot-dev-periph) [![Docker Size](https://img.shields.io/docker/image-size/ardupilot/ardupilot-dev-periph/latest)](https://hub.docker.com/r/ardupilot/ardupilot-dev-periph) [![Docker Pulls](https://img.shields.io/docker/pulls/ardupilot/ardupilot-dev-periph.svg)](https://hub.docker.com/r/ardupilot/ardupilot-dev-periph)
- [ardupilot/ardupilot-dev-ros](https://hub.docker.com/r/ardupilot/ardupilot-dev-ros) [![](https://images.microbadger.com/badges/image/ardupilot/ardupilot-dev-ros.svg)](http://microbadger.com/images/ardupilot/ardupilot-dev-ros) [![Docker Size](https://img.shields.io/docker/image-size/ardupilot/ardupilot-dev-ros/latest)](https://hub.docker.com/r/ardupilot/ardupilot-dev-ros) [![Docker Pulls](https://img.shields.io/docker/pulls/ardupilot/ardupilot-dev-ros.svg)](https://hub.docker.com/r/ardupilot/ardupilot-dev-ros)


## Building
Expand Down
92 changes: 92 additions & 0 deletions docker/Dockerfile_dev-ros
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
FROM ros:humble-ros-base 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-pip \
python3-setuptools \
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 clean autoclean \
&& sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN python -m pip install --no-cache-dir -U future lxml pexpect flake8 empy pyelftools tabulate pymavlink

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 clean 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
2 changes: 2 additions & 0 deletions scripts/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ echo "BUILDING COVERAGE"
docker build -t ardupilot/ardupilot-dev-coverage:latest -f Dockerfile_dev-coverage .
echo "BUILDING PERIPH"
docker build -t ardupilot/ardupilot-dev-periph:latest -f Dockerfile_dev-periph .
echo "BUILDING ROS2"
docker build -t ardupilot/ardupilot-dev-ros:latest -f Dockerfile_dev-ros .
popd

0 comments on commit b20cbba

Please sign in to comment.