Skip to content
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

V6.13.0 #2

Merged
merged 20 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Development Build

on:
pull_request:
branches:
- main
types:
- opened
- synchronize

jobs:
dev-build:
runs-on: ubuntu-latest

permissions:
packages: write
contents: read

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Extract Version for Dev Build
id: versioning
run: |
branch_name=${{ github.head_ref }}
if [[ "$branch_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
version=${branch_name#v}
echo "version=$version" >> $GITHUB_OUTPUT
echo "ghcr_tag=ghcr.io/thunderatz/stm32cubemx:${version}-dev" >> $GITHUB_OUTPUT
else
echo "Error: Branch name must follow 'vx.y.z' pattern." >&2
exit 1
fi
shell: bash

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Dev Docker Image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}
cache-to: type=inline

- name: Build and Push Dev Docker Image for G4 MCU
uses: docker/build-push-action@v3
with:
context: .
build-args: MCU=G4
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}-g4
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}-g4
cache-to: type=inline

- name: Build and Push Dev Docker Image for F4 MCU
uses: docker/build-push-action@v3
with:
context: .
build-args: MCU=F4
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}-f4
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}-f4
cache-to: type=inline

- name: Build and Push Dev Docker Image for F1 MCU
uses: docker/build-push-action@v3
with:
context: .
build-args: MCU=F1
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}-f1
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}-f1
cache-to: type=inline
89 changes: 89 additions & 0 deletions .github/workflows/prod-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Production Build

on:
pull_request:
branches:
- main
types:
- closed

jobs:
prod-build:
if: github.event.pull_request.merged == true

runs-on: ubuntu-latest

permissions:
packages: write
contents: read

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Extract Version for Production Build
id: versioning
run: |
branch_name=${{ github.head_ref }}
if [[ "$branch_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
version=${branch_name#v}
echo "version=$version" >> $GITHUB_OUTPUT
echo "ghcr_tag=ghcr.io/thunderatz/stm32cubemx:${version}" >> $GITHUB_OUTPUT
echo "docker_tag=thunderatz/stm32cubemx:${version}" >> $GITHUB_OUTPUT
else
echo "Error: Branch name must follow 'vx.y.z' pattern." >&2
exit 1
fi
shell: bash

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and Push Production Docker Image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }},${{ steps.versioning.outputs.docker_tag }}
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}
cache-to: type=inline

- name: Build and Push Production Docker Image for G4 MCU
uses: docker/build-push-action@v3
with:
context: .
build-args: MCU=G4
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}-g4,${{ steps.versioning.outputs.docker_tag }}-g4
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}-g4
cache-to: type=inline

- name: Build and Push Production Docker Image for F4 MCU
uses: docker/build-push-action@v3
with:
context: .
build-args: MCU=F4
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}-f4,${{ steps.versioning.outputs.docker_tag }}-f4
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}-f4
cache-to: type=inline

- name: Build and Push Production Docker Image for F1 MCU
uses: docker/build-push-action@v3
with:
context: .
build-args: MCU=F1
push: true
tags: ${{ steps.versioning.outputs.ghcr_tag }}-f1,${{ steps.versioning.outputs.docker_tag }}-f1
cache-from: type=registry,ref=ghcr.io/thunderatz/stm32cubemx:${{ steps.versioning.outputs.version }}-f1
cache-to: type=inline
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM ubuntu:24.04 AS stm32cubemx

RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y \
unzip \
xvfb \
wget \
openjdk-21-jre \
libgbm1 \
&& apt-get clean

RUN mkdir st && cd st && \
wget -nv https://sw-center.st.com/packs/resource/library/stm32cube_mx_v6130-lin.zip && \
unzip -q stm32cube_mx_v6130-lin.zip && \
unzip -q JavaJre.zip && \
mv MX /root/STM32CubeMX && \
mv jre /root/STM32CubeMX && \
cd .. && rm -rf st

ENV CUBE_PATH="/root/STM32CubeMX"

RUN echo "exit" > /root/cube-init && \
Xvfb :10 -ac > /dev/null & \
export DISPLAY=:10 && \
$CUBE_PATH/STM32CubeMX -q /root/cube-init && \
rm /root/cube-init && \
pkill -f Xvfb


RUN rm /tmp/.X10-lock

ARG MCU

RUN if [ -z "$MCU" ]; then \
echo "Docker built without MCU repository."; \
else \
apt-get install -y git && \
mkdir -p /root/STM32Cube/Repository && cd /root/STM32Cube/Repository && \
git clone https://github.com/STMicroelectronics/STM32Cube${MCU}.git && \
cd STM32Cube${MCU} && \
git submodule update --init --recursive; \
fi
133 changes: 131 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,131 @@
# stm32cubemx_docker
Docker configurations for STM32 development with CubeMX
<!-- markdownlint-disale -->
<div align="center">

STM32CubeMX Setup and Docker Environment for STM32 Projects

</div>

<div align="center">
<a href="https://www.docker.com/"><img alt="Built with Docker" src="https://img.shields.io/badge/built_with-Docker-blue?style=for-the-badge&labelColor=0c74b8&color=43a3c5" height="30"></a>
<a href="https://www.st.com/en/development-tools/stm32cubemx.html"><img alt="Uses STM32CubeMX" src="https://img.shields.io/badge/uses-stm32cubemx-blue?style=for-the-badge&labelColor=38c1d0&color=45a4b8" height="30"></a>
<a href="https://ubuntu.com"><img alt="Built on Ubuntu" src="https://img.shields.io/badge/built_on-Ubuntu-blue?style=for-the-badge&labelColor=5d8ab6&color=3f596f" height="30"></a>
</div>
<!-- markdownlint-restore -->

## 📑 Summary

- [📑 Summary](#-summary)
- [🔨 Building](#-building)
- [🚀 Running](#-running)
- [💻 Docker Setup](#-docker-setup)
- [👥 Contributing](#-contributing)
- [✨ Contributors](#-contributors)

## 🚀 Running

To use the `thunderatz/stm32cubemx` image in another container, you can pull it directly from the GitHub Container Registry (GHCR) or Docker Hub.

### 1. Pulling the Image

If you're using **Docker Hub**, use the following command:

```bash
docker pull thunderatz/stm32cubemx:6.13.0
```

If you're using **GHCR**, the command will be:

```bash
docker pull ghcr.io/thunderatz/stm32cubemx:6.13.0
```

### 2. Running the Image

After pulling the image, you can run it in a container with the following command. Make sure to adjust the volume according to your project:

```bash
docker run --rm -it \
-v /path/to/your/project:/workspace \
thunderatz/stm32cubemx:6.13.0
```

Or, if you're using **GHCR**:

```bash
docker run --rm -it \
-v /path/to/your/project:/workspace \
ghcr.io/thunderatz/stm32cubemx:6.13.0
```

## 🔨 Building

This project uses Docker to containerize the STM32CubeMX environment, making setup and development easier. Follow these steps to set up your environment:

### 1. Build the Docker Image

Make sure Docker is installed on your machine. To build the Docker image, run the following command in the project's root directory:

```bash
docker build -t stm32cubemx -f .
```

This will download and install all necessary dependencies, including STM32CubeMX and Java Runtime.

### 2. Run STM32CubeMX in Docker

Once the image is built, you can run STM32CubeMX inside the Docker container. To do this, execute the following command:

```bash
docker run -it --rm stm32cubemx
```

This will launch the STM32CubeMX environment inside the Docker container, allowing you to work on your STM32 project.

## 💻 Docker Setup

The Dockerfile provided in this repository creates a containerized environment for STM32CubeMX. It includes all the necessary dependencies to run STM32CubeMX on an Ubuntu system. Here's a summary of how the Dockerfile works:

- **Base Image**: The Dockerfile starts from the official Ubuntu 24.04 image.
- **Dependencies**: It installs essential packages such as `unzip`, `xvfb`, `wget`, `openjdk-21-jre`, and others required to run STM32CubeMX.
- **STM32CubeMX**: It downloads and sets up STM32CubeMX, along with the Java Runtime.
- **X11 Virtual Frame Buffer (Xvfb)**: A virtual X server is used to run the GUI-based STM32CubeMX in headless mode.

## 👥 Contributing

We welcome contributions! To contribute to the `ThundeRatz/stm32cubemx` project, please follow these guidelines:

1. **Fork the repository** – Start by forking this repository to your own GitHub account.

2. **Create a new branch** – When creating a new branch for your changes, please name the branch according to the version of STM32CubeMX you are working with. For example:

- `v6.13.1` for version 6.13.1 of STM32CubeMX
- `v6.14.0` for version 6.14.0 of STM32CubeMX

3. **Make your changes** – Implement the desired changes or fixes in your branch.

4. **Test your changes** – Ensure everything works as expected within the container. Build and verify the setup for STM32CubeMX.

5. **Submit a pull request** – Once your changes are ready, submit a pull request (PR) with a detailed description of the modifications.

We appreciate all contributions, whether it's reporting issues, suggesting features, or submitting fixes!

## ✨ Contributors

Thanks goes to these wonderful people:

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/Eduardo-Barreto"><img src="https://avatars.githubusercontent.com/u/34964398?v=4" width="100px;" alt="Eduardo Barreto"/><br/><sub><b>Eduardo Barreto</b></sub></a><br/><a href="https://github.com/ThundeRatz/stm32cubemx_docker/commits?author=Eduardo-Barreto" title="Code">💻</a> <a href="https://github.com/ThundeRatz/stm32cubemx_docker/commits?author=Eduardo-Barreto" title="Documentation">📖</a> <a href="#research-Eduardo-Barreto" title="Research">🔬</a> <a href="https://github.com/ThundeRatz/stm32cubemx_docker/pulls?q=is%3Apr+reviewed-by%3AEduardo-Barreto" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://github.com/GabrielCosme"><img src="https://avatars.githubusercontent.com/u/62270066?v=4?s=100" width="100px;" alt="Gabriel Cosme Barbosa"/><br/><sub><b>Gabriel Cosme Barbosa</b></sub></a><br/><a href="https://github.com/ThundeRatz/stm32cubemx_docker/commits?author=GabrielCosme" title="Code">💻</a> <a href="#research-GabrielCosme" title="Research">🔬</a> <a href="https://github.com/ThundeRatz/stm32cubemx_docker/pulls?q=is%3Apr+reviewed-by%3AGabrielCosme" title="Reviewed Pull Requests">👀</a></td>
</tr>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of all kinds are welcome!
Loading