new file: .devcontainer/devcontainer.json
new file: CubeClt/Dockerfile new file: CubeClt/Resources/CubeCLT/install.sh new file: CubeClt/Resources/Scripts/reinstall-cmake.sh new file: CubeClt/build_and_publish.sh new file: CubeMx/Dockerfile new file: CubeMx/Resources/CubeMX/install-cubemx.sh new file: CubeMx/build_and_publish.sh modified: README.md
This commit is contained in:
22
.devcontainer/devcontainer.json
Normal file
22
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
|
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
|
||||||
|
{
|
||||||
|
"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]
|
||||||
|
|
||||||
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
// "features": {},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Configure tool-specific properties.
|
||||||
|
// "customizations": {},
|
||||||
|
|
||||||
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "root"
|
||||||
|
|
||||||
|
}
|
||||||
30
CubeClt/Dockerfile
Normal file
30
CubeClt/Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12
|
||||||
|
|
||||||
|
ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="3.22.2"
|
||||||
|
|
||||||
|
ARG INSTALL_CUBE_CLT="true"
|
||||||
|
|
||||||
|
# Optionally install the cmake for vcpkg
|
||||||
|
COPY ./Resources/Scripts/reinstall-cmake.sh /tmp/
|
||||||
|
|
||||||
|
RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \
|
||||||
|
chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \
|
||||||
|
fi \
|
||||||
|
&& rm -f /tmp/reinstall-cmake.sh
|
||||||
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional vcpkg ports.
|
||||||
|
# RUN su vscode -c "${VCPKG_ROOT}/vcpkg install <your-port-name-here>"
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional packages.
|
||||||
|
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||||
|
|
||||||
24
CubeClt/Resources/CubeCLT/install.sh
Normal file
24
CubeClt/Resources/CubeCLT/install.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
59
CubeClt/Resources/Scripts/reinstall-cmake.sh
Normal file
59
CubeClt/Resources/Scripts/reinstall-cmake.sh
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#-------------------------------------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
|
||||||
|
#-------------------------------------------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CMAKE_VERSION=${1:-"none"}
|
||||||
|
|
||||||
|
if [ "${CMAKE_VERSION}" = "none" ]; then
|
||||||
|
echo "No CMake version specified, skipping CMake reinstallation"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
|
||||||
|
echo "Installing CMake..."
|
||||||
|
apt-get -y purge --auto-remove cmake
|
||||||
|
mkdir -p /opt/cmake
|
||||||
|
|
||||||
|
architecture=$(dpkg --print-architecture)
|
||||||
|
case "${architecture}" in
|
||||||
|
arm64)
|
||||||
|
ARCH=aarch64 ;;
|
||||||
|
amd64)
|
||||||
|
ARCH=x86_64 ;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported architecture ${architecture}."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CMAKE_BINARY_NAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh"
|
||||||
|
CMAKE_CHECKSUM_NAME="cmake-${CMAKE_VERSION}-SHA-256.txt"
|
||||||
|
TMP_DIR=$(mktemp -d -t cmake-XXXXXXXXXX)
|
||||||
|
|
||||||
|
echo "${TMP_DIR}"
|
||||||
|
cd "${TMP_DIR}"
|
||||||
|
|
||||||
|
curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_BINARY_NAME}" -O
|
||||||
|
curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_CHECKSUM_NAME}" -O
|
||||||
|
|
||||||
|
sha256sum -c --ignore-missing "${CMAKE_CHECKSUM_NAME}"
|
||||||
|
sh "${TMP_DIR}/${CMAKE_BINARY_NAME}" --prefix=/opt/cmake --skip-license
|
||||||
|
|
||||||
|
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
|
||||||
|
ln -s /opt/cmake/bin/ctest /usr/local/bin/ctest
|
||||||
22
CubeClt/build_and_publish.sh
Executable file
22
CubeClt/build_and_publish.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
push=false
|
||||||
|
# Process oprions
|
||||||
|
while getopts "pt:" opt; do
|
||||||
|
case $opt in
|
||||||
|
p) push=true;;
|
||||||
|
t) tag=$OPTARG;;
|
||||||
|
\?) echo "Invalid option: -$OPTARG" >&2 ;;
|
||||||
|
:) echo "Option -$OPTARG requires an argument." >&2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
docker build -t nexus.springblast.de:8082/carly/docker-stm32/cubeclt:$tag .
|
||||||
|
docker build -t nexus.springblast.de:8082/carly/docker-stm32/cubeclt:latest .
|
||||||
|
|
||||||
|
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
|
||||||
|
fi
|
||||||
24
CubeMx/Dockerfile
Normal file
24
CubeMx/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
FROM nexus.springblast.de:8082/carly/docker-stm32/cubeclt:latest
|
||||||
|
|
||||||
|
ARG INSTALL_CUBEMX="true"
|
||||||
|
|
||||||
|
# Install Xpra, X server, and window manager
|
||||||
|
RUN apt-get update && apt-get install -y xpra xorg openbox xauth xterm
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libxext6 \
|
||||||
|
libxrender1 \
|
||||||
|
libxtst6 \
|
||||||
|
libxi6
|
||||||
|
|
||||||
|
# Optionally install the CubeMX
|
||||||
|
COPY ./Resources/CubeMX/cubemx.tar.gz /home/vscode
|
||||||
|
RUN tar -xvf /home/vscode/cubemx.tar.gz
|
||||||
|
|
||||||
|
# RUN if [ "${INSTALL_CUBEMX}" = "true" ]; then \
|
||||||
|
# chmod +x /tmp/CubeMX/install-cubemx.sh && /tmp/CubeMX/install-cubemx.sh; \
|
||||||
|
# fi
|
||||||
|
# && rm -rf /tmp/CubeMX
|
||||||
|
|
||||||
|
#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
|
||||||
22
CubeMx/Resources/CubeMX/install-cubemx.sh
Normal file
22
CubeMx/Resources/CubeMX/install-cubemx.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
|
||||||
15
CubeMx/build_and_publish.sh
Executable file
15
CubeMx/build_and_publish.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
push=false
|
||||||
|
# Process oprions
|
||||||
|
while getopts "pt:" opt; do
|
||||||
|
case $opt in
|
||||||
|
p) push=true;;
|
||||||
|
t) tag=$OPTARG;;
|
||||||
|
\?) echo "Invalid option: -$OPTARG" >&2 ;;
|
||||||
|
:) echo "Option -$OPTARG requires an argument." >&2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
docker build -t nexus.springblast.de:8082/carly/docker-stm32/cubemx:$tag .
|
||||||
Reference in New Issue
Block a user