Skip to content

Commit

Permalink
containers base/nuttx use PX4 setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Jun 23, 2020
1 parent 9522fd4 commit 99330d4
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 170 deletions.
88 changes: 29 additions & 59 deletions docker/Dockerfile_base-bionic
Original file line number Diff line number Diff line change
Expand Up @@ -10,71 +10,25 @@ ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

RUN apt-get update && apt-get -y --quiet --no-install-recommends install \
bzip2 \
ca-certificates \
ccache \
cmake \
cppcheck \
curl \
default-jdk-headless \
dirmngr \
doxygen \
file \
g++ \
gcc \
gdb \
git \
gnupg \
gosu \
lcov \
libfreetype6-dev \
libgtest-dev \
libpng-dev \
libssl-dev \
lsb-release \
make \
ninja-build \
openjdk-8-jdk \
openjdk-8-jre \
openssh-client \
pkg-config \
python3-dev \
python3-pip \
rsync \
shellcheck \
tzdata \
unzip \
valgrind \
wget \
xsltproc \
zip \
&& cd /tmp \
&& wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/ubuntu.sh \
&& wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/requirements.txt \
&& bash ubuntu.sh --no-nuttx --no-sim-tools \
&& apt-get -y autoremove \
&& apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*

# gtest
RUN cd /usr/src/gtest \
&& mkdir build && cd build \
&& cmake .. && make -j$(nproc) \
&& cp *.a /usr/lib \
&& cd .. && rm -rf build

# Install Python 3 pip build dependencies first.
RUN pip3 install wheel setuptools

# Python 3 dependencies installed by pip
RUN pip3 install argparse argcomplete coverage cerberus empy jinja2 \
matplotlib==3.0.* numpy packaging pkgconfig pyros-genmsg pyulog \
pyyaml requests serial six toml psutil pyulog wheel

# manual ccache setup
RUN ln -s /usr/bin/ccache /usr/lib/ccache/cc \
&& ln -s /usr/bin/ccache /usr/lib/ccache/c++

# astyle v3.1
RUN wget -q https://downloads.sourceforge.net/project/astyle/astyle/astyle%203.1/astyle_3.1_linux.tar.gz -O /tmp/astyle.tar.gz \
&& cd /tmp && tar zxf astyle.tar.gz && cd astyle/src \
&& make -f ../build/gcc/Makefile -j$(nproc) && cp bin/astyle /usr/local/bin \
&& rm -rf /tmp/*
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Gradle (Required to build Fast-RTPS-Gen)
RUN wget -q "https://services.gradle.org/distributions/gradle-6.3-rc-4-bin.zip" -O /tmp/gradle-6.3-rc-4-bin.zip \
Expand All @@ -85,20 +39,36 @@ RUN wget -q "https://services.gradle.org/distributions/gradle-6.3-rc-4-bin.zip"

ENV PATH "/opt/gradle/gradle-6.3-rc-4/bin:$PATH"

# Fast-RTPS 1.8.2
RUN git clone --recursive https://github.com/eProsima/Fast-RTPS.git -b v1.8.2 /tmp/FastRTPS-1.8.2 \
&& cd /tmp/FastRTPS-1.8.2 \
# Intall foonathan_memory from source as it is required to Fast-RTPS >= 1.9
RUN git clone https://github.com/eProsima/foonathan_memory_vendor.git /tmp/foonathan_memory \
&& cd /tmp/foonathan_memory \
&& mkdir build && cd build \
&& cmake .. \
&& cmake --build . --target install -- -j $(nproc) \
&& rm -rf /tmp/foonathan_memory

# Fast-RTPS 1.9.4
RUN git clone --recursive https://github.com/eProsima/Fast-RTPS.git -b v1.9.4 /tmp/FastRTPS \
&& cd /tmp/FastRTPS \
&& mkdir build && cd build \
&& cmake -DTHIRDPARTY=ON -DSECURITY=ON .. \
&& cmake --build . --target install -- -j $(nproc) \
&& rm -rf /tmp/*
&& rm -rf /tmp/FastRTPS

# Fast-RTPS-Gen 1.0.4
RUN git clone --recursive https://github.com/eProsima/Fast-RTPS-Gen.git -b v1.0.4 /tmp/Fast-RTPS-Gen-1.0.4 \
&& cd /tmp/Fast-RTPS-Gen-1.0.4 \
RUN git clone --recursive https://github.com/eProsima/Fast-RTPS-Gen.git -b v1.0.4 /tmp/Fast-RTPS-Gen \
&& cd /tmp/Fast-RTPS-Gen \
&& gradle assemble \
&& gradle install \
&& rm -rf /tmp/*
&& rm -rf /tmp/Fast-RTPS-Gen

# cleanup
RUN rm -rf \
/var/lib/apt/lists/* \
/tmp/* /var/tmp/* \
/root/.cache \
/root/.gradle \
/root/.local \

# create user with id 1001 (jenkins docker workflow default)
RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user
Expand Down
80 changes: 21 additions & 59 deletions docker/Dockerfile_base-focal
Original file line number Diff line number Diff line change
Expand Up @@ -10,71 +10,25 @@ ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

RUN apt-get update && apt-get -y --quiet --no-install-recommends install \
bzip2 \
ca-certificates \
ccache \
cmake \
cppcheck \
curl \
default-jdk-headless \
dirmngr \
doxygen \
file \
g++ \
gcc \
gdb \
git \
gnupg \
gosu \
lcov \
libfreetype6-dev \
libgtest-dev \
libpng-dev \
libssl-dev \
lsb-release \
make \
ninja-build \
openjdk-8-jdk \
openjdk-8-jre \
openssh-client \
pkg-config \
python3-dev \
python3-pip \
rsync \
shellcheck \
tzdata \
unzip \
valgrind \
wget \
xsltproc \
zip \
&& cd /tmp \
&& wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/ubuntu.sh \
&& wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/requirements.txt \
&& bash ubuntu.sh --no-nuttx --no-sim-tools \
&& apt-get -y autoremove \
&& apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*

# gtest
RUN cd /usr/src/gtest \
&& mkdir build && cd build \
&& cmake .. && make -j$(nproc) \
&& find . -name \*.a -exec cp {} /usr/lib \; \
&& cd .. && rm -rf build

# Install Python 3 pip build dependencies first.
RUN python3 -m pip install --upgrade pip wheel setuptools

# Python 3 dependencies installed by pip
RUN python3 -m pip install argparse argcomplete coverage cerberus empy jinja2 \
matplotlib==3.0.* numpy packaging pkgconfig pyros-genmsg pyulog \
pyyaml requests serial six toml psutil pyulog wheel

# manual ccache setup
RUN ln -s /usr/bin/ccache /usr/lib/ccache/cc \
&& ln -s /usr/bin/ccache /usr/lib/ccache/c++

# astyle v3.1
RUN wget -q https://downloads.sourceforge.net/project/astyle/astyle/astyle%203.1/astyle_3.1_linux.tar.gz -O /tmp/astyle.tar.gz \
&& cd /tmp && tar zxf astyle.tar.gz && cd astyle/src \
&& make -f ../build/gcc/Makefile -j$(nproc) && cp bin/astyle /usr/local/bin \
&& rm -rf /tmp/*
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Gradle (Required to build Fast-RTPS-Gen)
RUN wget -q "https://services.gradle.org/distributions/gradle-6.3-rc-4-bin.zip" -O /tmp/gradle-6.3-rc-4-bin.zip \
Expand All @@ -91,22 +45,30 @@ RUN git clone https://github.com/eProsima/foonathan_memory_vendor.git /tmp/foona
&& mkdir build && cd build \
&& cmake .. \
&& cmake --build . --target install -- -j $(nproc) \
&& rm -rf /tmp/*
&& rm -rf /tmp/foonathan_memory

# Fast-RTPS 1.9.4
RUN git clone --recursive https://github.com/eProsima/Fast-RTPS.git -b v1.9.4 /tmp/FastRTPS-1.9.4 \
&& cd /tmp/FastRTPS-1.9.4 \
RUN git clone --recursive https://github.com/eProsima/Fast-RTPS.git -b v1.9.4 /tmp/FastRTPS \
&& cd /tmp/FastRTPS \
&& mkdir build && cd build \
&& cmake -DTHIRDPARTY=ON -DSECURITY=ON .. \
&& cmake --build . --target install -- -j $(nproc) \
&& rm -rf /tmp/*
&& rm -rf /tmp/FastRTPS

# Fast-RTPS-Gen 1.0.4
RUN git clone --recursive https://github.com/eProsima/Fast-RTPS-Gen.git -b v1.0.4 /tmp/Fast-RTPS-Gen-1.0.4 \
&& cd /tmp/Fast-RTPS-Gen-1.0.4 \
RUN git clone --recursive https://github.com/eProsima/Fast-RTPS-Gen.git -b v1.0.4 /tmp/Fast-RTPS-Gen \
&& cd /tmp/Fast-RTPS-Gen \
&& gradle assemble \
&& gradle install \
&& rm -rf /tmp/*
&& rm -rf /tmp/Fast-RTPS-Gen

# cleanup
RUN rm -rf \
/var/lib/apt/lists/* \
/tmp/* /var/tmp/* \
/root/.cache \
/root/.gradle \
/root/.local \

# create user with id 1001 (jenkins docker workflow default)
RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user
Expand Down
41 changes: 15 additions & 26 deletions docker/Dockerfile_nuttx-bionic
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,20 @@
# PX4 NuttX development environment in Ubuntu 18.04 Bionic
#

FROM px4io/px4-dev-base-bionic:2020-06-20
FROM px4io/px4-dev-base-bionic:2020-06-23
LABEL maintainer="Daniel Agar <[email protected]>"

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
autoconf \
automake \
bison \
build-essential \
bzip2 \
file \
flex \
genromfs \
gperf \
libncurses-dev \
libtool \
pkg-config \
uncrustify \
vim-common \
RUN cd /tmp \
&& wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/ubuntu.sh \
&& wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/requirements.txt \
&& bash ubuntu.sh --no-sim-tools \
&& apt-get -y autoremove \
&& apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*

# GNU Arm Embedded Toolchain Version 9-2019-q4-major Released: November 06, 2019
RUN mkdir -p /opt/gcc && cd /opt/gcc \
&& wget -qO- "https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2" | tar jx --strip 1 \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
&& rm -rf /opt/gcc/share/doc

ENV PATH="$PATH:/opt/gcc/bin"

# 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

# nuttx tools
RUN git clone --depth 1 https://bitbucket.org/nuttx/tools.git /tmp/tools \
&& cd /tmp/tools/kconfig-frontends \
Expand All @@ -47,3 +27,12 @@ RUN git clone --depth 1 https://bitbucket.org/nuttx/tools.git /tmp/tools \
RUN git clone --recursive https://github.com/google/bloaty.git /tmp/bloaty \
&& cd /tmp/bloaty && cmake -GNinja . && ninja -j $(nproc) bloaty && cp bloaty /usr/local/bin/ \
&& rm -rf /tmp/*

# cleanup
RUN rm -rf \
/var/lib/apt/lists/* \
/tmp/* /var/tmp/* \
/root/.cache \
/root/.gradle \
/root/.local

41 changes: 15 additions & 26 deletions docker/Dockerfile_nuttx-focal
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,20 @@
# PX4 NuttX development environment in Ubuntu 20.04 Focal
#

FROM px4io/px4-dev-base-focal:2020-06-20
FROM px4io/px4-dev-base-focal:2020-06-23
LABEL maintainer="Daniel Agar <[email protected]>"

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
autoconf \
automake \
bison \
build-essential \
bzip2 \
file \
flex \
genromfs \
gperf \
libncurses-dev \
libtool \
pkg-config \
uncrustify \
vim-common \
RUN cd /tmp \
&& wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/ubuntu.sh \
&& wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/requirements.txt \
&& bash ubuntu.sh --no-sim-tools \
&& apt-get -y autoremove \
&& apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*

# GNU Arm Embedded Toolchain Version 9-2019-q4-major Released: November 06, 2019
RUN mkdir -p /opt/gcc && cd /opt/gcc \
&& wget -qO- "https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2" | tar jx --strip 1 \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
&& rm -rf /opt/gcc/share/doc

ENV PATH="$PATH:/opt/gcc/bin"

# 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

# nuttx tools
RUN git clone --depth 1 https://bitbucket.org/nuttx/tools.git /tmp/tools \
&& cd /tmp/tools/kconfig-frontends \
Expand All @@ -47,3 +27,12 @@ RUN git clone --depth 1 https://bitbucket.org/nuttx/tools.git /tmp/tools \
RUN git clone --recursive https://github.com/google/bloaty.git /tmp/bloaty \
&& cd /tmp/bloaty && cmake -GNinja . && ninja -j $(nproc) bloaty && cp bloaty /usr/local/bin/ \
&& rm -rf /tmp/*

# cleanup
RUN rm -rf \
/var/lib/apt/lists/* \
/tmp/* /var/tmp/* \
/root/.cache \
/root/.gradle \
/root/.local

0 comments on commit 99330d4

Please sign in to comment.