From afe409f9d2374e4b930e0adba3d7cfb9199895e4 Mon Sep 17 00:00:00 2001 From: marc Date: Mon, 26 May 2025 23:05:40 +0200 Subject: [PATCH] new cube clt and mx version new docker registry --- .devcontainer/devcontainer.json | 38 ++++++++++++++++------- CubeClt/Dockerfile | 33 +++++++++++++------- CubeClt/Resources/CubeCLT/install.sh | 24 -------------- CubeClt/build_and_publish.sh | 8 ++--- CubeMx/Dockerfile | 36 +++++++++------------ CubeMx/Resources/CubeMX/install-cubemx.sh | 22 ------------- CubeMx/Resources/CubeMX/start-cubemx.sh | 1 - CubeMx/Resources/auto-install.xml | 12 +++++++ CubeMx/build_and_publish.sh | 8 ++--- 9 files changed, 83 insertions(+), 99 deletions(-) delete mode 100644 CubeClt/Resources/CubeCLT/install.sh delete mode 100644 CubeMx/Resources/CubeMX/install-cubemx.sh delete mode 100755 CubeMx/Resources/CubeMX/start-cubemx.sh create mode 100644 CubeMx/Resources/auto-install.xml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fee4307..c352e31 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,19 +4,35 @@ "name": "Debian", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "dockerFile": "../CubeMx/Dockerfile", - "privileged": true, - "forwardPorts": [14500, 14500] + "mounts": [ + // 1. Share the X11 socket for GUI display + "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached", - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, + // 2. Share the D-Bus system socket (resolves the system_bus_socket error) + "source=/var/run/dbus/system_bus_socket,target=/var/run/dbus/system_bus_socket,type=bind,consistency=cached", - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], + // 3. Share .Xauthority for X11 authorization (resolves "Authorization required" error) + // Ensure the target path matches the container user's home. + "source=/run/user/1000/xauth_MASbDk,target=/home/vscode/.Xauthority,type=bind,consistency=cached" + // Make sure to adjust /home/vscode if your container user's home directory is different. + ], - // Configure tool-specific properties. - // "customizations": {}, + "containerEnv": { + // 4. Set the DISPLAY variable to use the host's X server + "DISPLAY": "${localEnv:DISPLAY}", - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" + // 5. If using .Xauthority mount, point to its location in the container + "XAUTHORITY": "/home/vscode/.Xauthority" + }, + + // Optional: Command to ensure the container user owns the .Xauthority file if mounted. + // Adjust 'vscode' if your container user is different. + // "postCreateCommand": "sudo chown vscode:vscode /home/vscode/.Xauthority || echo 'Xauthority not found or permission change failed, this might be okay.'", + + + // Generally, avoid privileged: true. + // If you encounter permission issues that aren't solved by the above, + // adding specific capabilities is safer. + "privileged": true -} +} \ No newline at end of file diff --git a/CubeClt/Dockerfile b/CubeClt/Dockerfile index 307c0dd..2ab8ee3 100644 --- a/CubeClt/Dockerfile +++ b/CubeClt/Dockerfile @@ -2,7 +2,9 @@ FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12 ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="3.22.2" -ARG INSTALL_CUBE_CLT="true" +ARG LICENSE_ALREADY_ACCEPTED=1 + +RUN apt-get update && apt-get upgrade -y # Optionally install the cmake for vcpkg COPY ./Resources/Scripts/reinstall-cmake.sh /tmp/ @@ -14,18 +16,25 @@ RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \ # Optionally install the Cube CLT -COPY ../Resources/CubeCLT /tmp/CubeCLT/ -RUN if [ "${INSTALL_CUBE_CLT}" = "true" ]; then \ - chmod +x /tmp/CubeCLT/install.sh && /tmp/CubeCLT/install.sh; \ - fi \ -&& rm -rf /tmp/CubeCLT +RUN apt-get install --no-install-recommends -y unzip +RUN mkdir /home/temp +WORKDIR /home/temp -RUN apt-get clean +RUN wget http://192.168.1.225:8081/repository/file/Stm32/en.st-stm32cubeclt_1.18.0_24403_20250225_1636_amd64.deb_bundle.sh.zip +RUN unzip en.st-stm32cubeclt_1.18.0_24403_20250225_1636_amd64.deb_bundle.sh.zip +RUN chmod +x st-stm32cubeclt_1.18.0_24403_20250225_1636_amd64.deb_bundle.sh && ./st-stm32cubeclt_1.18.0_24403_20250225_1636_amd64.deb_bundle.sh +WORKDIR / +RUN rm -rf /home/temp -# [Optional] Uncomment this section to install additional vcpkg ports. -# RUN su vscode -c "${VCPKG_ROOT}/vcpkg install " +WORKDIR /home/vscode +RUN apt-get install --no-install-recommends -y python3-pip python3-venv +RUN python3 -m venv venv && ./venv/bin/pip install --no-cache-dir pyserial protobuf grpcio grpcio-tools + + +RUN usermod -aG sudo,dialout,plugdev vscode +RUN apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +USER vscode -# [Optional] Uncomment this section to install additional packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends diff --git a/CubeClt/Resources/CubeCLT/install.sh b/CubeClt/Resources/CubeCLT/install.sh deleted file mode 100644 index 7532b9d..0000000 --- a/CubeClt/Resources/CubeCLT/install.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -# Set the script to fail if any command fails. -set -e - -echo "Installing CubeCLT..." - -# Extract zip file -unzip -q /tmp/CubeCLT/en.st-stm32cubeclt_1.17* -d /tmp/cubeclt -cd /tmp/cubeclt && chmod +x *.sh -export LICENSE_ALREADY_ACCEPTED=1 -/tmp/cubeclt/*.sh --target . --noexec - -export DEBIAN_FRONTEND=noninteractive -apt-get update -apt-get install -y /tmp/cubeclt/st-stlink-udev-rules*.deb -apt-get install -y /tmp/cubeclt/st-stlink-server*.deb -apt-get install -y /tmp/cubeclt/st-stm32cubeclt*.deb - -rm -rf /tmp/cubeclt - - - - diff --git a/CubeClt/build_and_publish.sh b/CubeClt/build_and_publish.sh index 53ed800..57c3062 100755 --- a/CubeClt/build_and_publish.sh +++ b/CubeClt/build_and_publish.sh @@ -14,10 +14,10 @@ done -docker build -t nexus.springblast.de:8082/carly/docker-stm32/cubeclt:$tag $script_dir/. -docker build -t nexus.springblast.de:8082/carly/docker-stm32/cubeclt:latest $script_dir/. +docker build -t docker.springblast.de/stm32/cubeclt:$tag $script_dir/. +docker build -t docker.springblast.de/stm32/cubeclt:latest $script_dir/. if [ "$push" = true ]; then - docker push nexus.springblast.de:8082/carly/docker-stm32/cubeclt:$tag - docker push nexus.springblast.de:8082/carly/docker-stm32/cubeclt:latest + docker push docker.springblast.de/stm32/cubeclt:$tag + docker push docker.springblast.de/stm32/cubeclt:latest fi diff --git a/CubeMx/Dockerfile b/CubeMx/Dockerfile index cdd78ec..5b4e26d 100644 --- a/CubeMx/Dockerfile +++ b/CubeMx/Dockerfile @@ -1,31 +1,25 @@ -FROM nexus.springblast.de:8082/carly/docker-stm32/cubeclt:latest +FROM docker.springblast.de/stm32/cubeclt:latest -ARG INSTALL_CUBEMX="true" +ARG LICENSE_ALREADY_ACCEPTED=1 +USER root # Install Xpra, X server, and window manager # RUN apt-get update && apt-get install -y xpra xterm -# Optionally install the CubeMX -COPY ./Resources/CubeMX/cubemx.tar.gz /home/vscode -RUN tar -xvf /home/vscode/cubemx.tar.gz -C /home/vscode -RUN rm /home/vscode/cubemx.tar.gz +RUN apt-get update && apt-get install --no-install-recommends -y chromium -COPY ./Resources/CubeMX/start-cubemx.sh /home/vscode/ -RUN chmod +x /home/vscode/start-cubemx.sh +RUN mkdir /home/temp +WORKDIR /home/temp +RUN wget -q https://nexus.springblast.de/repository/file-repo/Stm32/en.stm32cubemx-lin-v6-14-1.zip -RUN apt-get update && apt-get install -y python3-setuptools - -RUN cd /home/vscode && git clone --branch v6.2.5 --single-branch https://github.com/Xpra-org/xpra - -RUN cd /home/vscode/xpra && ./setup.py install-repo && apt-get update && apt-get install -y xpra - -RUN apt-get clean +RUN unzip en.stm32cubemx-lin-v6-14-1.zip +RUN chmod +x SetupSTM32CubeMX-6.14.1 -# RUN if [ "${INSTALL_CUBEMX}" = "true" ]; then \ -# chmod +x /tmp/CubeMX/install-cubemx.sh && /tmp/CubeMX/install-cubemx.sh; \ -# fi - # && rm -rf /tmp/CubeMX +COPY ./Resources/auto-install.xml . +RUN ./SetupSTM32CubeMX-6.14.1 auto-install.xml - #CMD xpra start --start=xeyes --bind-tcp=0.0.0.0:14500 --html=on --daemon=no && bash - #sudo xpra start :100 --start=xterm --no-daemon --bind-tcp=0.0.0.0:14500 --html=on \ No newline at end of file +RUN rm -rf /home/temp + +RUN apt-get clean && \ + rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/CubeMx/Resources/CubeMX/install-cubemx.sh b/CubeMx/Resources/CubeMX/install-cubemx.sh deleted file mode 100644 index dbe7e0e..0000000 --- a/CubeMx/Resources/CubeMX/install-cubemx.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -# Set the script to fail if any command fails. -set -e - -# Cleanup temporary directory and associated files when exiting the script. -cleanup() { - EXIT_CODE=$? - set +e - if [[ -n "${TMP_DIR}" ]]; then - echo "Executing cleanup of tmp files" - rm -Rf "${TMP_DIR}" - fi - exit $EXIT_CODE -} - -echo "Installing CubeMX..." - -# Extract zip file -unzip -q /tmp/CubeMX/en.stm32cubemx-lin-v6-13-0.zip -d /tmp/CubeMX - - diff --git a/CubeMx/Resources/CubeMX/start-cubemx.sh b/CubeMx/Resources/CubeMX/start-cubemx.sh deleted file mode 100755 index db2c472..0000000 --- a/CubeMx/Resources/CubeMX/start-cubemx.sh +++ /dev/null @@ -1 +0,0 @@ -xpra start :100 --start=/home/vscode/STM32CubeMX/STM32CubeMX --no-daemon --bind-tcp=0.0.0.0:14500 --html=on \ No newline at end of file diff --git a/CubeMx/Resources/auto-install.xml b/CubeMx/Resources/auto-install.xml new file mode 100644 index 0000000..c5da6e2 --- /dev/null +++ b/CubeMx/Resources/auto-install.xml @@ -0,0 +1,12 @@ + + + + + + + /usr/local/STMicroelectronics/STM32Cube/STM32CubeMX + + + + + diff --git a/CubeMx/build_and_publish.sh b/CubeMx/build_and_publish.sh index 6677ccd..c87d57d 100755 --- a/CubeMx/build_and_publish.sh +++ b/CubeMx/build_and_publish.sh @@ -13,10 +13,10 @@ while getopts "pt:" opt; do done -docker build -t nexus.springblast.de:8082/carly/docker-stm32/cubemx:$tag $script_dir/. -docker build -t nexus.springblast.de:8082/carly/docker-stm32/cubemx:latest $script_dir/. +docker build -t docker.springblast.de/stm32/cubemx:$tag $script_dir/. +docker build -t docker.springblast.de/stm32/cubemx:latest $script_dir/. if [ "$push" = true ]; then - docker push nexus.springblast.de:8082/carly/docker-stm32/cubemx:$tag - docker push nexus.springblast.de:8082/carly/docker-stm32/cubemx:latest + docker push docker.springblast.de/stm32/cubemx:$tag + docker push docker.springblast.de/stm32/cubemx:latest fi \ No newline at end of file