|
1 | 1 | FROM ubuntu:24.04 |
2 | 2 |
|
3 | 3 | ARG DEBIAN_FRONTEND=noninteractive |
| 4 | +# Pin the last STM32Cube IDE core package that still ships the Linux cube |
| 5 | +# downloader. Newer 1.2.x packages currently only contain win32/cube.exe, |
| 6 | +# which would otherwise build a silently broken image without starm-clang. |
| 7 | +ARG STM32CUBE_IDE_CORE_VERSION=1.1.0 |
| 8 | +ARG STM32CUBE_IDE_CORE_VSIX_URL="https://stmicroelectronics.gallerycdn.vsassets.io/extensions/stmicroelectronics/stm32cube-ide-core/1.1.0/1765810657223/Microsoft.VisualStudio.Services.VSIXPackage" |
4 | 9 |
|
5 | 10 | LABEL maintainer="2592509183@qq.com" |
6 | 11 | LABEL description="This is a Docker Image for XRobot build." |
7 | 12 |
|
8 | 13 | RUN apt update |
9 | 14 |
|
10 | | -RUN apt upgrade -y --no-install-recommends && apt install -y --no-install-recommends xz-utils git curl sudo wget zip unzip make && apt install -y net-tools usbutils util-linux expect nano gdb cmake ninja-build file clang-tidy gcc g++ python3-tk && apt clean |
| 15 | +RUN apt upgrade -y --no-install-recommends && apt install -y --no-install-recommends xz-utils git curl sudo wget zip unzip make && apt install -y net-tools usbutils util-linux nano gdb cmake ninja-build file clang-tidy gcc g++ python3-tk && apt clean |
11 | 16 |
|
12 | 17 | RUN apt-get update && \ |
13 | 18 | apt-get install -y --no-install-recommends \ |
14 | 19 | xz-utils git curl sudo wget zip unzip make \ |
15 | | - net-tools usbutils util-linux expect expect-dev nano gdb cmake ninja-build file clang-tidy gcc g++ python3-tk libgpiod-dev && \ |
16 | | - apt-get clean |
| 20 | + net-tools usbutils util-linux nano gdb cmake ninja-build file clang-tidy gcc g++ python3-tk libgpiod-dev && \ |
| 21 | + apt-get clean |
17 | 22 |
|
18 | | -RUN curl -L -o stm32cube-ide-core.vsix \ |
| 23 | +RUN curl -L -o stm32cube-ide-core.pkg \ |
19 | 24 | -H "Accept: application/octet-stream" \ |
20 | 25 | -A "Mozilla/5.0" \ |
21 | | - "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/stmicroelectronics/vsextensions/stm32cube-ide-core/latest/vspackage" && \ |
22 | | - mv stm32cube-ide-core.vsix stm32cube-ide-core.vsix.gz && \ |
23 | | - gunzip stm32cube-ide-core.vsix.gz && \ |
24 | | - unzip stm32cube-ide-core.vsix && \ |
25 | | - cat > download.exp <<'EOF' |
26 | | -spawn extension/resources/binaries/linux/x86_64/cube bundle download st-arm-clang |
27 | | -set timeout -1 |
28 | | -expect { |
29 | | - -re "Proceed with download.*" { |
30 | | - send "yes\r" |
31 | | - exp_continue |
32 | | - } |
33 | | - eof |
34 | | -} |
35 | | -EOF |
36 | | - |
37 | | -RUN if [ -x extension/resources/binaries/linux/x86_64/cube ]; then \ |
38 | | - script -q -c "expect download.exp" /dev/null && \ |
39 | | - rm download.exp && \ |
40 | | - BUNDLE_FILE=$(ls -t *.bundle | head -n1) && \ |
41 | | - mkdir -p /opt/st-arm-clang && \ |
42 | | - unzip "$BUNDLE_FILE" -d /opt/st-arm-clang; \ |
| 26 | + "${STM32CUBE_IDE_CORE_VSIX_URL}" && \ |
| 27 | + if file stm32cube-ide-core.pkg | grep -qi "gzip compressed"; then \ |
| 28 | + mv stm32cube-ide-core.pkg stm32cube-ide-core.vsix.gz && \ |
| 29 | + gunzip stm32cube-ide-core.vsix.gz; \ |
43 | 30 | else \ |
44 | | - echo "Linux STM32Cube downloader not found in stm32cube-ide-core.vsix; skipping st-arm-clang bundle install."; \ |
45 | | - rm download.exp; \ |
| 31 | + mv stm32cube-ide-core.pkg stm32cube-ide-core.vsix; \ |
46 | 32 | fi && \ |
47 | | - rm -rf extension *.bundle *.vsix stm32cube-ide-core.vsix.gz |
48 | | - |
49 | | -RUN if [ -d /opt/st-arm-clang/bin ]; then \ |
50 | | - for exe in /opt/st-arm-clang/bin/*; do \ |
51 | | - ln -sf "$exe" /usr/bin/$(basename "$exe"); \ |
52 | | - done; \ |
53 | | - fi |
| 33 | + unzip -q stm32cube-ide-core.vsix && \ |
| 34 | + test -x extension/resources/binaries/linux/x86_64/cube || \ |
| 35 | + (echo "Linux STM32Cube downloader missing in stm32cube-ide-core ${STM32CUBE_IDE_CORE_VERSION}" >&2 && exit 1) && \ |
| 36 | + extension/resources/binaries/linux/x86_64/cube bundle download --yes st-arm-clang && \ |
| 37 | + BUNDLE_FILE=$(find . -maxdepth 1 -type f -name 'st-arm-clang*-linux.bundle' | head -n1) && \ |
| 38 | + test -n "$BUNDLE_FILE" && \ |
| 39 | + mkdir -p /opt/st-arm-clang && \ |
| 40 | + unzip "$BUNDLE_FILE" -d /opt/st-arm-clang && \ |
| 41 | + rm -rf extension *.bundle stm32cube-ide-core.pkg stm32cube-ide-core.vsix stm32cube-ide-core.vsix.gz |
| 42 | + |
| 43 | +RUN test -x /opt/st-arm-clang/bin/starm-clang && \ |
| 44 | + test -x /opt/st-arm-clang/bin/starm-clang++ && \ |
| 45 | + for exe in /opt/st-arm-clang/bin/*; do \ |
| 46 | + ln -sf "$exe" /usr/bin/$(basename "$exe"); \ |
| 47 | + done && \ |
| 48 | + command -v starm-clang && \ |
| 49 | + command -v starm-clang++ |
54 | 50 |
|
55 | 51 |
|
56 | 52 | RUN sudo mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.bk |
|
0 commit comments