From 37730082d994bbfe8b50b2d9765bdeefe123d5dd Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 23 Jun 2020 12:52:30 -0400 Subject: [PATCH] containers base/nuttx use PX4 setup script --- docker/Dockerfile_base-bionic | 80 +++++++++------------------------- docker/Dockerfile_base-focal | 72 ++++++------------------------ docker/Dockerfile_nuttx-bionic | 32 +++----------- docker/Dockerfile_nuttx-focal | 32 +++----------- 4 files changed, 46 insertions(+), 170 deletions(-) diff --git a/docker/Dockerfile_base-bionic b/docker/Dockerfile_base-bionic index 745bb00d..cdc3ea02 100644 --- a/docker/Dockerfile_base-bionic +++ b/docker/Dockerfile_base-bionic @@ -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 \ @@ -85,20 +39,28 @@ 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 # create user with id 1001 (jenkins docker workflow default) RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user diff --git a/docker/Dockerfile_base-focal b/docker/Dockerfile_base-focal index 0bc95c38..658b7b9a 100644 --- a/docker/Dockerfile_base-focal +++ b/docker/Dockerfile_base-focal @@ -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 \ @@ -91,22 +45,22 @@ 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 # create user with id 1001 (jenkins docker workflow default) RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user diff --git a/docker/Dockerfile_nuttx-bionic b/docker/Dockerfile_nuttx-bionic index 818f54b4..52e3d2eb 100644 --- a/docker/Dockerfile_nuttx-bionic +++ b/docker/Dockerfile_nuttx-bionic @@ -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 " -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 \ diff --git a/docker/Dockerfile_nuttx-focal b/docker/Dockerfile_nuttx-focal index 99ba5d23..61b9714f 100644 --- a/docker/Dockerfile_nuttx-focal +++ b/docker/Dockerfile_nuttx-focal @@ -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 " -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 \