|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 | +# contributor license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright ownership. The |
| 4 | +# ASF licenses this file to you under the Apache License, Version 2.0 (the |
| 5 | +# "License"); you may not use this file except in compliance with the |
| 6 | +# License. You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | +# License for the specific language governing permissions and limitations |
| 14 | +# under the License. |
| 15 | + |
| 16 | +FROM ubuntu:19.04 AS builder-base |
| 17 | +# NOTE WE ARE NOT REMOVEING APT CACHE. |
| 18 | +# This should only be used for temp build images that artifacts will be copied from |
| 19 | +RUN apt-get update -qq && apt-get install -y -qq \ |
| 20 | + curl \ |
| 21 | + xz-utils |
| 22 | + |
| 23 | +############################################################################### |
| 24 | +# Base image that should be used to prepare tools from nuttx-tools |
| 25 | +############################################################################### |
| 26 | +FROM builder-base AS nuttx-tools |
| 27 | + |
| 28 | +RUN apt-get install -y -qq \ |
| 29 | + flex \ |
| 30 | + bison \ |
| 31 | + gperf \ |
| 32 | + libncurses5-dev \ |
| 33 | + make |
| 34 | + |
| 35 | +RUN mkdir /tools |
| 36 | +WORKDIR /tools |
| 37 | + |
| 38 | +RUN mkdir -p /tools/nuttx-tools |
| 39 | +RUN curl -s -L https://bitbucket.org/nuttx/tools/get/9ad3e1ee75c7.tar.gz \ |
| 40 | + | tar -C nuttx-tools --strip-components=1 -xz |
| 41 | + |
| 42 | +RUN cd nuttx-tools/kconfig-frontends \ |
| 43 | + && ./configure --enable-mconf --disable-gconf --disable-qconf --enable-static --prefix=/tools/kconfig-frontends \ |
| 44 | + && make install |
| 45 | + |
| 46 | +RUN cd nuttx-tools \ |
| 47 | + && mkdir genromfs \ |
| 48 | + && tar -C genromfs --strip-components=1 -xf genromfs-0.5.2.tar.gz \ |
| 49 | + && cd genromfs \ |
| 50 | + && make install PREFIX=/tools/genromfs |
| 51 | + |
| 52 | +CMD [ "/bin/bash" ] |
| 53 | + |
| 54 | +############################################################################### |
| 55 | +# Base image that should be used to prepare arch build images |
| 56 | +############################################################################### |
| 57 | +FROM builder-base AS nuttx-toolchain-base |
| 58 | + |
| 59 | +RUN mkdir /tools |
| 60 | +WORKDIR /tools |
| 61 | + |
| 62 | +############################################################################### |
| 63 | +# Build image for tool required by ARM builds |
| 64 | +############################################################################### |
| 65 | +FROM nuttx-toolchain-base AS nuttx-toolchain-arm |
| 66 | +# Download the latest ARM GCC toolchain prebuilt by ARM |
| 67 | +RUN mkdir gcc-arm-none-eabi && \ |
| 68 | + curl -s -L "https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2?revision=108bd959-44bd-4619-9c19-26187abf5225&la=en&hash=E788CE92E5DFD64B2A8C246BBA91A249CB8E2D2D" \ |
| 69 | + | tar -C gcc-arm-none-eabi --strip-components 1 -xj |
| 70 | + |
| 71 | +############################################################################### |
| 72 | +# Build image for tool required by Pinguino builds |
| 73 | +############################################################################### |
| 74 | +FROM nuttx-toolchain-base AS nuttx-toolchain-pinguino |
| 75 | +# Download the pinguino compilers. Note this includes both 8bit and 32bit |
| 76 | +# toolchains and builds for multiple host systems. Only copy what is needed. |
| 77 | +RUN mkdir pinguino-compilers && \ |
| 78 | + curl -s -L "https://github.com/PinguinoIDE/pinguino-compilers/archive/62db5158d7f6d41c6fadb05de81cc31dd81a1958.tar.gz" \ |
| 79 | + | tar -C pinguino-compilers --strip-components=2 --wildcards -xz */linux64 |
| 80 | + |
| 81 | +############################################################################### |
| 82 | +# Build image for tool required by RISCV builds |
| 83 | +############################################################################### |
| 84 | +FROM nuttx-toolchain-base AS nuttx-toolchain-riscv |
| 85 | +# Download the latest RISCV GCC toolchain prebuilt by SiFive |
| 86 | +RUN mkdir riscv64-unknown-elf-gcc && \ |
| 87 | + curl -s -L "https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz" \ |
| 88 | + | tar -C riscv64-unknown-elf-gcc --strip-components 1 -xz |
| 89 | + |
| 90 | +############################################################################### |
| 91 | +# Build image for tool required by ESP32 builds |
| 92 | +############################################################################### |
| 93 | +FROM nuttx-toolchain-base AS nuttx-toolchain-esp32 |
| 94 | +# Download the latest ESP32 GCC toolchain prebuilt by Espressif |
| 95 | +RUN mkdir xtensa-esp32-elf-gcc && \ |
| 96 | + curl -s -L "https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-rc2-linux-amd64.tar.xz" \ |
| 97 | + | tar -C xtensa-esp32-elf-gcc --strip-components 1 -xJ |
| 98 | + |
| 99 | + |
| 100 | +############################################################################### |
| 101 | +# Final Docker image used for running CI system. This includes all toolchains |
| 102 | +# supported by the CI system. |
| 103 | +############################################################################### |
| 104 | +FROM ubuntu:19.04 |
| 105 | +LABEL maintainer="dev@nuttx.apache.org" |
| 106 | + |
| 107 | +RUN dpkg --add-architecture i386 |
| 108 | +# This is used for the final images so make sure to not store apt cache |
| 109 | +RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \ |
| 110 | + git \ |
| 111 | + build-essential \ |
| 112 | + wget \ |
| 113 | + libx11-dev \ |
| 114 | + libxext-dev \ |
| 115 | + u-boot-tools \ |
| 116 | + lib32z1-dev \ |
| 117 | + libc6-dev-i386 \ |
| 118 | + libx11-dev:i386 \ |
| 119 | + libxext-dev:i386 \ |
| 120 | + curl \ |
| 121 | + gettext \ |
| 122 | + libcurl4-openssl-dev \ |
| 123 | + xxd \ |
| 124 | + unzip \ |
| 125 | + python3 \ |
| 126 | + python3-pip \ |
| 127 | + && rm -rf /var/lib/apt/lists/* |
| 128 | + |
| 129 | + |
| 130 | +# Configure out base setup for adding python packages |
| 131 | +ENV PIP_DISABLE_PIP_VERSION_CHECK=true |
| 132 | +# This disables the cache with value 0. We do not want caching as it |
| 133 | +# increases the images size. |
| 134 | +ENV PIP_NO_CACHE_DIR=0 |
| 135 | +# We are using the minimal python installation from the system so include |
| 136 | +# setuptools and also wheel so we can use the binary releases of packages |
| 137 | +# instead of requiring them to be compiled. |
| 138 | +RUN pip3 install setuptools wheel |
| 139 | + |
| 140 | +RUN mkdir /tools |
| 141 | +WORKDIR /tools |
| 142 | + |
| 143 | +# Pull in the tools we just built for nuttx |
| 144 | +COPY --from=nuttx-tools /tools/genromfs/ /tools/genromfs/ |
| 145 | +ENV PATH="/tools/genromfs/usr/bin:$PATH" |
| 146 | +COPY --from=nuttx-tools /tools/kconfig-frontends/ kconfig-frontends/ |
| 147 | +ENV PATH="/tools/kconfig-frontends/bin:$PATH" |
| 148 | + |
| 149 | +# ARM toolchain |
| 150 | +COPY --from=nuttx-toolchain-arm /tools/gcc-arm-none-eabi/ gcc-arm-none-eabi/ |
| 151 | +ENV PATH="/tools/gcc-arm-none-eabi/bin:$PATH" |
| 152 | + |
| 153 | +COPY --from=nuttx-toolchain-pinguino /tools/pinguino-compilers/p32/ pinguino-compilers/p32/ |
| 154 | +ENV PATH="/tools/pinguino-compilers/p32/bin:$PATH" |
| 155 | +#COPY --from=nuttx-toolchain-pinguino /tools/pinguino-compilers/p8/ pinguino-compilers/p8/ |
| 156 | +#ENV PATH="/tools/pinguino-compilers/p8/bin:$PATH" |
| 157 | + |
| 158 | +# RISCV toolchain |
| 159 | +COPY --from=nuttx-toolchain-riscv /tools/riscv64-unknown-elf-gcc/ riscv64-unknown-elf-gcc/ |
| 160 | +ENV PATH="/tools/riscv64-unknown-elf-gcc/bin:$PATH" |
| 161 | + |
| 162 | +# ESP32 toolchain |
| 163 | +COPY --from=nuttx-toolchain-esp32 /tools/xtensa-esp32-elf-gcc/ xtensa-esp32-elf-gcc/ |
| 164 | +ENV PATH="/tools/xtensa-esp32-elf-gcc/bin:$PATH" |
| 165 | +RUN pip3 install esptool |
| 166 | + |
| 167 | +ENTRYPOINT [ "/bin/bash" ] |
0 commit comments