-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/Devcontainer #620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Feat/Devcontainer #620
Changes from all commits
08eccf5
dbe5a20
6773c6e
da1d2f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| release: none | ||
| summary: Add devcontainer config and fix some things to hyperloop-firmware-toolchain | ||
|
|
||
| Use **Ubuntu 22.04** instead of 24.04 in the package image to eliminate the ubuntu 20.04 Focal hack. Also adds **devcontainer** config and installs **stlink-server**. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| FROM ghcr.io/hyperloop-upv/hyperloop-firmware-toolchain:latest | ||
|
|
||
| WORKDIR /workspaces | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "name": "ST-LIB Dev Container", | ||
| "build": { | ||
| "dockerfile": "Containerfile" | ||
| }, | ||
| "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
| "containerEnv": { | ||
| "CONTAINER_NAME": "stm32-project" | ||
| }, | ||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "ms-vscode.cpptools", | ||
| "marus25.cortex-debug", | ||
| "twxs.cmake", | ||
| "ms-vscode.cmake-tools" | ||
| ] | ||
| } | ||
| }, | ||
| "containerUser": "root", | ||
| "updateRemoteUserUID": true | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,45 +1,47 @@ | ||||||||||||||||||||||||||||||||
| FROM ubuntu:24.04 | ||||||||||||||||||||||||||||||||
| FROM ubuntu:22.04 | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ARG DEBIAN_FRONTEND=noninteractive | ||||||||||||||||||||||||||||||||
| ARG CUBECLT_VERSION=1.21.0 | ||||||||||||||||||||||||||||||||
| ARG CUBECLT_INSTALLER=cubeclt_${CUBECLT_VERSION}_installer.sh | ||||||||||||||||||||||||||||||||
| ARG UV_INSTALLER_URL=https://astral.sh/uv/install.sh | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| RUN echo "deb http://security.ubuntu.com/ubuntu focal-security main universe" > /etc/apt/sources.list.d/ubuntu-focal-sources.list && \ | ||||||||||||||||||||||||||||||||
| apt-get update && \ | ||||||||||||||||||||||||||||||||
| apt-get install -y --no-install-recommends \ | ||||||||||||||||||||||||||||||||
| bash ca-certificates curl git git-lfs \ | ||||||||||||||||||||||||||||||||
| python3 python3-pip python3-venv \ | ||||||||||||||||||||||||||||||||
| cmake ninja-build \ | ||||||||||||||||||||||||||||||||
| g++ build-essential \ | ||||||||||||||||||||||||||||||||
| libncurses5 libusb-1.0-0 \ | ||||||||||||||||||||||||||||||||
| gdb && \ | ||||||||||||||||||||||||||||||||
| git lfs install --system && \ | ||||||||||||||||||||||||||||||||
| rm -rf /var/lib/apt/lists/* | ||||||||||||||||||||||||||||||||
| # 1. Install System Dependencies (Revised for Programmer CLI) | ||||||||||||||||||||||||||||||||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||||||||||||||||||||||||||||||||
| build-essential cmake ninja-build git git-lfs \ | ||||||||||||||||||||||||||||||||
| python3 python3-pip python3-venv curl \ | ||||||||||||||||||||||||||||||||
| libncurses5 libusb-1.0-0 stlink-tools openocd \ | ||||||||||||||||||||||||||||||||
| libglib2.0-0 libusb-0.1-4 libsm6 libice6 \ | ||||||||||||||||||||||||||||||||
| tio cu lsb-release \ | ||||||||||||||||||||||||||||||||
| && rm -rf /var/lib/apt/lists/* | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| RUN curl -LsSf "${UV_INSTALLER_URL}" | sh && \ | ||||||||||||||||||||||||||||||||
| ln -sf /root/.local/bin/uv /usr/local/bin/uv && \ | ||||||||||||||||||||||||||||||||
| python3 -m pip install --break-system-packages \ | ||||||||||||||||||||||||||||||||
| Jinja2==3.1.5 \ | ||||||||||||||||||||||||||||||||
| GitPython==3.1.43 | ||||||||||||||||||||||||||||||||
| RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \ | ||||||||||||||||||||||||||||||||
| ln -sf /root/.local/bin/uv /usr/local/bin/uv | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Install cubeclt (STM32CubeCLT) | ||||||||||||||||||||||||||||||||
| WORKDIR /tmp | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| RUN git clone --depth 1 https://github.com/Hyperloop-UPV/cubeclt.git && \ | ||||||||||||||||||||||||||||||||
| cd cubeclt && \ | ||||||||||||||||||||||||||||||||
| git lfs pull --include="${CUBECLT_INSTALLER}" && \ | ||||||||||||||||||||||||||||||||
| chmod +x ${CUBECLT_INSTALLER} && \ | ||||||||||||||||||||||||||||||||
| echo | LICENSE_ALREADY_ACCEPTED=1 ./${CUBECLT_INSTALLER} && \ | ||||||||||||||||||||||||||||||||
| actual_root="$(find /opt/st -maxdepth 1 -type d -name "stm32cubeclt_${CUBECLT_VERSION}*" | head -n1)" && \ | ||||||||||||||||||||||||||||||||
| test -n "${actual_root}" && \ | ||||||||||||||||||||||||||||||||
| mkdir -p /opt/ST && \ | ||||||||||||||||||||||||||||||||
| ln -s "${actual_root}" "/opt/ST/STM32CubeCLT_${CUBECLT_VERSION}" && \ | ||||||||||||||||||||||||||||||||
| cd / && \ | ||||||||||||||||||||||||||||||||
| rm -rf /tmp/cubeclt | ||||||||||||||||||||||||||||||||
| ./${CUBECLT_INSTALLER} --target /tmp/extract --noexec && \ | ||||||||||||||||||||||||||||||||
| # --- Part A: STM32CubeCLT --- | ||||||||||||||||||||||||||||||||
| mkdir -p /opt/st/STM32CubeCLT_${CUBECLT_VERSION} && \ | ||||||||||||||||||||||||||||||||
| tar -xzf /tmp/extract/st-stm32cubeclt_*.tar.gz -C /opt/st/STM32CubeCLT_${CUBECLT_VERSION} --strip-components=1 && \ | ||||||||||||||||||||||||||||||||
| cp /tmp/extract/version.txt /opt/st/STM32CubeCLT_${CUBECLT_VERSION}/version.txt && \ | ||||||||||||||||||||||||||||||||
| # --- Part B: ST-LINK Server --- | ||||||||||||||||||||||||||||||||
| export LICENSE_ALREADY_ACCEPTED=1 && \ | ||||||||||||||||||||||||||||||||
| SERVER_INSTALL=$(ls /tmp/extract/st-stlink-server.*.install.sh) && \ | ||||||||||||||||||||||||||||||||
|
Comment on lines
+28
to
+32
|
||||||||||||||||||||||||||||||||
| tar -xzf /tmp/extract/st-stm32cubeclt_*.tar.gz -C /opt/st/STM32CubeCLT_${CUBECLT_VERSION} --strip-components=1 && \ | |
| cp /tmp/extract/version.txt /opt/st/STM32CubeCLT_${CUBECLT_VERSION}/version.txt && \ | |
| # --- Part B: ST-LINK Server --- | |
| export LICENSE_ALREADY_ACCEPTED=1 && \ | |
| SERVER_INSTALL=$(ls /tmp/extract/st-stlink-server.*.install.sh) && \ | |
| CUBECLT_ARCHIVE_COUNT=$(find /tmp/extract -maxdepth 1 -type f -name 'st-stm32cubeclt_*.tar.gz' | wc -l) && \ | |
| [ "$CUBECLT_ARCHIVE_COUNT" -eq 1 ] || { echo "Expected exactly one STM32CubeCLT archive in /tmp/extract, found $CUBECLT_ARCHIVE_COUNT" >&2; find /tmp/extract -maxdepth 1 -type f -name 'st-stm32cubeclt_*.tar.gz' >&2; exit 1; } && \ | |
| CUBECLT_ARCHIVE=$(find /tmp/extract -maxdepth 1 -type f -name 'st-stm32cubeclt_*.tar.gz' -print -quit) && \ | |
| tar -xzf "$CUBECLT_ARCHIVE" -C /opt/st/STM32CubeCLT_${CUBECLT_VERSION} --strip-components=1 && \ | |
| cp /tmp/extract/version.txt /opt/st/STM32CubeCLT_${CUBECLT_VERSION}/version.txt && \ | |
| # --- Part B: ST-LINK Server --- | |
| export LICENSE_ALREADY_ACCEPTED=1 && \ | |
| SERVER_INSTALL_COUNT=$(find /tmp/extract -maxdepth 1 -type f -name 'st-stlink-server.*.install.sh' | wc -l) && \ | |
| [ "$SERVER_INSTALL_COUNT" -eq 1 ] || { echo "Expected exactly one ST-LINK Server installer in /tmp/extract, found $SERVER_INSTALL_COUNT" >&2; find /tmp/extract -maxdepth 1 -type f -name 'st-stlink-server.*.install.sh' >&2; exit 1; } && \ | |
| SERVER_INSTALL=$(find /tmp/extract -maxdepth 1 -type f -name 'st-stlink-server.*.install.sh' -print -quit) && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The devcontainer base image is referenced as
:latest, which makes the environment non-reproducible and can break developers unexpectedly when the image is updated. Prefer pinning to a specific version tag and/or digest, and update it intentionally when toolchain changes are needed.