|
1 | | -FROM ubuntu:24.04 |
| 1 | +FROM ubuntu:22.04 |
2 | 2 |
|
3 | | -ARG DEBIAN_FRONTEND=noninteractive |
| 3 | +ENV DEBIAN_FRONTEND=noninteractive |
4 | 4 | ARG CUBECLT_VERSION=1.21.0 |
5 | 5 | ARG CUBECLT_INSTALLER=cubeclt_${CUBECLT_VERSION}_installer.sh |
6 | | -ARG UV_INSTALLER_URL=https://astral.sh/uv/install.sh |
7 | 6 |
|
8 | | -RUN echo "deb http://security.ubuntu.com/ubuntu focal-security main universe" > /etc/apt/sources.list.d/ubuntu-focal-sources.list && \ |
9 | | - apt-get update && \ |
10 | | - apt-get install -y --no-install-recommends \ |
11 | | - bash ca-certificates curl git git-lfs \ |
12 | | - python3 python3-pip python3-venv \ |
13 | | - cmake ninja-build \ |
14 | | - g++ build-essential \ |
15 | | - libncurses5 libusb-1.0-0 \ |
16 | | - gdb && \ |
17 | | - git lfs install --system && \ |
18 | | - rm -rf /var/lib/apt/lists/* |
| 7 | +# 1. Install System Dependencies (Revised for Programmer CLI) |
| 8 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 9 | + build-essential cmake ninja-build git git-lfs \ |
| 10 | + python3 python3-pip python3-venv curl \ |
| 11 | + libncurses5 libusb-1.0-0 stlink-tools openocd \ |
| 12 | + libglib2.0-0 libusb-0.1-4 libsm6 libice6 \ |
| 13 | + tio cu lsb-release \ |
| 14 | + && rm -rf /var/lib/apt/lists/* |
19 | 15 |
|
20 | | -RUN curl -LsSf "${UV_INSTALLER_URL}" | sh && \ |
21 | | - ln -sf /root/.local/bin/uv /usr/local/bin/uv && \ |
22 | | - python3 -m pip install --break-system-packages \ |
23 | | - Jinja2==3.1.5 \ |
24 | | - GitPython==3.1.43 |
| 16 | +RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \ |
| 17 | + ln -sf /root/.local/bin/uv /usr/local/bin/uv |
25 | 18 |
|
26 | | -# Install cubeclt (STM32CubeCLT) |
27 | 19 | WORKDIR /tmp |
28 | 20 |
|
29 | 21 | RUN git clone --depth 1 https://github.com/Hyperloop-UPV/cubeclt.git && \ |
30 | 22 | cd cubeclt && \ |
31 | 23 | git lfs pull --include="${CUBECLT_INSTALLER}" && \ |
32 | 24 | chmod +x ${CUBECLT_INSTALLER} && \ |
33 | | - echo | LICENSE_ALREADY_ACCEPTED=1 ./${CUBECLT_INSTALLER} && \ |
34 | | - actual_root="$(find /opt/st -maxdepth 1 -type d -name "stm32cubeclt_${CUBECLT_VERSION}*" | head -n1)" && \ |
35 | | - test -n "${actual_root}" && \ |
36 | | - mkdir -p /opt/ST && \ |
37 | | - ln -s "${actual_root}" "/opt/ST/STM32CubeCLT_${CUBECLT_VERSION}" && \ |
38 | | - cd / && \ |
39 | | - rm -rf /tmp/cubeclt |
| 25 | + ./${CUBECLT_INSTALLER} --target /tmp/extract --noexec && \ |
| 26 | + # --- Part A: STM32CubeCLT --- |
| 27 | + mkdir -p /opt/st/STM32CubeCLT_${CUBECLT_VERSION} && \ |
| 28 | + tar -xzf /tmp/extract/st-stm32cubeclt_*.tar.gz -C /opt/st/STM32CubeCLT_${CUBECLT_VERSION} --strip-components=1 && \ |
| 29 | + cp /tmp/extract/version.txt /opt/st/STM32CubeCLT_${CUBECLT_VERSION}/version.txt && \ |
| 30 | + # --- Part B: ST-LINK Server --- |
| 31 | + export LICENSE_ALREADY_ACCEPTED=1 && \ |
| 32 | + SERVER_INSTALL=$(ls /tmp/extract/st-stlink-server.*.install.sh) && \ |
| 33 | + sh "$SERVER_INSTALL" --target /tmp/server_extract --noexec && \ |
| 34 | + cp /tmp/server_extract/stlink-server /usr/bin/stlink-server && \ |
| 35 | + chmod +x /usr/bin/stlink-server && \ |
| 36 | + # --- Part C: FIX THE PATH MISMATCH --- |
| 37 | + # Create the directory structure the VS Code extension expects |
| 38 | + mkdir -p /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer && \ |
| 39 | + ln -s /opt/st/STM32CubeCLT_${CUBECLT_VERSION}/STM32CubeProgrammer/bin /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin && \ |
| 40 | + # Cleanup |
| 41 | + cd / && rm -rf /tmp/cubeclt /tmp/extract /tmp/server_extract |
40 | 42 |
|
41 | | -ENV STM32_CLT_ROOT=/opt/ST/STM32CubeCLT_${CUBECLT_VERSION} |
42 | | -ENV HYPER_STM32CLT_ROOT=/opt/ST/STM32CubeCLT_${CUBECLT_VERSION} |
43 | | -ENV PATH="/root/.local/bin:${STM32_CLT_ROOT}/GNU-tools-for-STM32/bin:${STM32_CLT_ROOT}/STM32CubeProgrammer/bin:${STM32_CLT_ROOT}/CMake/bin:${STM32_CLT_ROOT}/Ninja/bin:${PATH}" |
| 43 | +ENV STM32_CLT_ROOT=/opt/st/STM32CubeCLT_${CUBECLT_VERSION} |
| 44 | +ENV HYPER_STM32CLT_ROOT=/opt/st/STM32CubeCLT_${CUBECLT_VERSION} |
| 45 | +ENV PATH="/root/.local/bin:${STM32_CLT_ROOT}/GNU-tools-for-STM32/bin:${STM32_CLT_ROOT}/STM32CubeProgrammer/bin:${STM32_CLT_ROOT}/STLink-gdb-server/bin:${STM32_CLT_ROOT}/CMake/bin:${STM32_CLT_ROOT}/Ninja/bin:${PATH}" |
44 | 46 |
|
45 | | -WORKDIR /workspace |
| 47 | +WORKDIR /workspaces |
0 commit comments