|
| 1 | +FROM ubuntu:latest AS downloader |
| 2 | +RUN apt-get update \ |
| 3 | + && apt-get -y install --no-install-recommends apt-utils \ |
| 4 | + && apt-get install -y \ |
| 5 | + curl \ |
| 6 | + xz-utils \ |
| 7 | + unzip \ |
| 8 | + wget |
| 9 | + |
| 10 | +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted |
| 11 | + |
| 12 | +ARG GCC_VERSION=13.3.rel1 |
| 13 | +ARG GCC_URI=https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/$GCC_VERSION/binrel/arm-gnu-toolchain-$GCC_VERSION-x86_64-arm-none-eabi.tar.xz |
| 14 | +RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted/gcc \ |
| 15 | + && curl -o /tmp/dc-downloads/gcc-arm.tar.xz $GCC_URI \ |
| 16 | + && xz -d /tmp/dc-downloads/gcc-arm.tar.xz \ |
| 17 | + && tar -xvf /tmp/dc-downloads/gcc-arm.tar -C /tmp/dc-extracted/gcc --strip-components 1 \ |
| 18 | + && rm -rf /tmp/dc-extracted/gcc/share/doc/ /tmp/dc-extracted/gcc/share/gcc-arm-none-eabi/samples/ |
| 19 | + |
| 20 | +ARG CMAKE_VERSION=3.31.6 |
| 21 | +ARG CMAKE_SCRIPT=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh |
| 22 | +RUN wget $CMAKE_SCRIPT \ |
| 23 | + -q -O /tmp/dc-downloads/cmake-install.sh \ |
| 24 | + && chmod u+x /tmp/dc-downloads/cmake-install.sh \ |
| 25 | + && mkdir -p /tmp/dc-extracted/cmake \ |
| 26 | + && /tmp/dc-downloads/cmake-install.sh --skip-license --prefix=/tmp/dc-extracted/cmake \ |
| 27 | + && rm /tmp/dc-downloads/cmake-install.sh |
| 28 | + |
| 29 | +FROM ubuntu:latest AS devcontainer |
| 30 | + |
| 31 | +# Avoid warnings by switching to noninteractive |
| 32 | +ENV DEBIAN_FRONTEND=noninteractive |
| 33 | + |
| 34 | +# You can set up non-root user |
| 35 | +# ARG USERNAME=vscode |
| 36 | +# ARG USER_UID=1000 |
| 37 | +# ARG USER_GID=$USER_UID |
| 38 | + |
| 39 | +# Configure apt and install packages |
| 40 | +RUN apt-get update \ |
| 41 | + && apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \ |
| 42 | + && apt-get install -y \ |
| 43 | + git \ |
| 44 | + git-svn \ |
| 45 | + subversion \ |
| 46 | + clang-format \ |
| 47 | + curl \ |
| 48 | + ninja-build \ |
| 49 | + srecord \ |
| 50 | + python3 \ |
| 51 | + python3-pip \ |
| 52 | + libusb-1.0-0-dev \ |
| 53 | + pkg-config \ |
| 54 | + build-essential |
| 55 | + |
| 56 | +# Create needed directories |
| 57 | +RUN mkdir -p /usr/local/bin/gcc |
| 58 | + |
| 59 | +# ============================================================ |
| 60 | +# KEY DIFFERENCE from ChibiOS container: |
| 61 | +# Clone ChibiOS master/trunk which has RP2040/RP2350 support |
| 62 | +# The stable_21.11.x branch does NOT include RP ports. |
| 63 | +# ============================================================ |
| 64 | +# Try GitHub mirror first (faster), fall back to SVN trunk |
| 65 | +RUN git clone --branch master https://github.com/ChibiOS/ChibiOS.git --depth 1 ./sources/ChibiOs \ |
| 66 | + || git svn clone http://svn.code.sf.net/p/chibios/code/trunk -rHEAD ./sources/ChibiOs |
| 67 | + |
| 68 | +# NO STM32 Cube packages — not needed for RP targets |
| 69 | + |
| 70 | +# Clone dependent repos (mbedtls, fatfs, littlefs, lwIP) |
| 71 | +RUN git clone --branch R0.16 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ |
| 72 | + && git clone --branch v2.11.2 https://github.com/littlefs-project/littlefs --depth 1 ./sources/littlefs \ |
| 73 | + && git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip \ |
| 74 | + && git clone --branch mbedtls-3.6.5 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ |
| 75 | + && cd ./sources/mbedtls \ |
| 76 | + && git submodule update --init --recursive |
| 77 | + |
| 78 | +# set gcc location |
| 79 | +ARG TMP_GCC_PATH=/usr/local/bin/gcc |
| 80 | +ENV ARM_GCC_PATH=$TMP_GCC_PATH/bin |
| 81 | + |
| 82 | +# Copy from our other container |
| 83 | +COPY --from=downloader /tmp/dc-extracted/gcc $TMP_GCC_PATH |
| 84 | +COPY --from=downloader /tmp/dc-extracted/cmake /usr/bin/cmake |
| 85 | + |
| 86 | +ENV PATH=/usr/bin/cmake/bin:${PATH} |
| 87 | + |
| 88 | +# picotool is NOT included — it requires the Pico SDK (PICO_SDK_PATH) to build. |
| 89 | +# Since we use ChibiOS (not the Pico SDK), picotool can be added later if UF2 |
| 90 | +# conversion is needed, by also cloning the pico-sdk. |
| 91 | +# hex2dfu is NOT included — RP targets use UF2 format, not DFU |
| 92 | +# srecord is still useful for bin packaging |
| 93 | + |
| 94 | +# Install Python dependencies for Kconfig configuration system |
| 95 | +RUN pip3 install --no-cache-dir --break-system-packages pyserial "kconfiglib>=14.1.0" |
| 96 | + |
| 97 | +# Clean up downloaded files |
| 98 | +RUN apt-get autoremove -y \ |
| 99 | + && apt-get clean -y \ |
| 100 | + && rm -rf /var/lib/apt/lists/* |
| 101 | + |
| 102 | +# Install .NET SDK 9.0 and .NET 8.0 runtime (needed by nanoFramework build tooling) |
| 103 | +RUN curl -sSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh \ |
| 104 | + && chmod +x /tmp/dotnet-install.sh \ |
| 105 | + && /tmp/dotnet-install.sh --channel 9.0 --install-dir /usr/share/dotnet \ |
| 106 | + && /tmp/dotnet-install.sh --channel 8.0 --runtime dotnet --install-dir /usr/share/dotnet \ |
| 107 | + && ln -sf /usr/share/dotnet/dotnet /usr/local/bin/dotnet \ |
| 108 | + && rm /tmp/dotnet-install.sh |
| 109 | + |
| 110 | +ENV DOTNET_ROOT=/usr/share/dotnet |
| 111 | + |
| 112 | +# Switch back to dialog for any ad-hoc use of apt-get |
| 113 | +ENV DEBIAN_FRONTEND=dialog |
0 commit comments