cancel
Showing results for 
Search instead for 
Did you mean: 

How to install STM32CubeCLT in docker container?

cla
Associate II

Hello

I am new to this forum, so if I am at the wrong place, let me know.

How can this software: https://www.st.com/en/development-tools/stm32cubeclt.html be installed from a script? Namely into docker container?

I get the following error:

``` DISPLAY not set. Cannot display license. Aborting. ```

Thanks in advance.

12 REPLIES 12

It is exactely what we do.

My bad, it works also with 1.18.0. I was using the generic Linux package instead of the Debian one. With the Debian package and an Ubuntu base image it's working well.

JuhaV
Associate

Evening everyone,

This is something we have been using in our company for a while now when doing CI-pipelines and deploying devcontainer tools for our employees. For some reason I previously dug the tools from CubeIDE package, which works also pretty good. 

In this approach only the absolutely mandatory stuff is put inside the container. There are some libraries which could be removed, but 2,3gig image is not that bad, since it serves its purpose as a build container.

We use CMake and Ninja for building our FW and started that before STM had proper tooling for VS Code, so basically it is vanilla setup.

1. Download the cubeclt package for debian.

2. Save this to Dockerfile in a separate folder with the .zip of CubeCLT

3. docker build -t cubeclt .

 

FROM debian:bookworm-slim AS basecontainer

ARG CUBECLT=st-stm32cubeclt_1.19.0_25876_20250729_1159_amd64.deb_bundle

ENV LICENSE_ALREADY_ACCEPTED=1

WORKDIR /workdir
COPY ${CUBECLT}.sh.zip .
RUN apt update && apt install unzip && unzip ${CUBECLT}.sh.zip && chmod 777 ./${CUBECLT}.sh && ./${CUBECLT}.sh --tar xvf \
    && rm ${CUBECLT}.sh.zip \
    && rm ${CUBECLT}.sh && ./setup.sh && rm -rf *

## Fresh container for the final build
FROM debian:bookworm-slim AS cubeclt

LABEL maintainer="Juha Viitanen <juha.viitanen@exertus.fi>"
LABEL purpose="STM32 H7 basecontainer"
LABEL version="1.0"
LABEL description="This Docker container sets up STM32CubeIDE and STM32 build tools for development."
LABEL user="exertus"
# Install local user
ARG USERNAME=exertus
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
    && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
    && usermod -aG root $USERNAME

# Install environmental variables
ENV CMAKE_INSTALL_PREFIX=/opt/toolchain/arm-none-eabi
ENV TOOLCHAIN_DIR=${CMAKE_INSTALL_PREFIX}
ENV PREFIX=${CMAKE_INSTALL_PREFIX}
ENV CROSS_COMPILE=arm-none-eabi-
ENV CC=${CROSS_COMPILE}gcc
ENV CXX=${CROSS_COMPILE}g++
ENV LD=${CROSS_COMPILE}ld
ENV AR=${CROSS_COMPILE}ar
ENV AS=${CROSS_COMPILE}as
ENV STRIP=${CROSS_COMPILE}strip
ENV PATH=${PATH}:${TOOLCHAIN_DIR}/bin

RUN mkdir /opt/toolchain
# Copy toolchain and required applications for previous container
COPY --from=basecontainer /opt/st/stm32cubeclt_1.19.0/GNU-tools-for-STM32 ${TOOLCHAIN_DIR}
COPY --from=basecontainer /opt/st/stm32cubeclt_1.19.0/STM32CubeProgrammer /usr/

# Package installation
RUN apt-get update \
    && apt-get install -y tzdata locales ca-certificates\
    && echo "Europe/Helsinki" > /etc/timezone \
    && ln -sf /usr/share/zoneinfo/Europe/Helsinki /etc/localtime \
    && dpkg-reconfigure -f noninteractive tzdata \
    # Install tools
    && apt-get install --no-install-recommends -y unzip zip ninja-build\
    # STM CUBE Programmer dependencies
    libglib2.0-dev libusb-1.0-0 libgssapi-krb5-2 \
    # Build tools
    cmake make git \
    # Sudo
    sudo \
    # Default user exertus for sudoers, if local user is used
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
    && chmod 0440 /etc/sudoers.d/$USERNAME \
    # Remove cache
    && apt-get clean && rm -rf /var/lib/apt/lists/*