Build marlin firmware using platformio-core inside a docker container
8.3K
This docker image contains platformio-core and a bash script, for conveniently compiling Marlin firmware with your own configuration.
To use this image, you need to provide a folder containing your *.h configuration files. All files with this extension will be copied to the Marlin/ folder, replacing existing configuration files.
Configuration examples for most Marlin based 3d-printers can be found here.
You also need to set the BOARD environment variable, this should contain the default_envs value for your 3d-printer control board. This value can in most cases be found the vendor page/repo, or in firmware guides by the community.
You can create a .env file with the variables BOARD, MARLIN_FIRMWARE and MARLIN_CONFIGURATION next to the docker-compose.yml file, or set the variables in your shell.
There is an example .env file in the examples/ folder.
Run docker-compose run build to compile the marlin firmware.
You can source a .env file (such as the one provided in the examples/ folder), set the shell variables manually or alter the environment and path arguments with values.
docker run --rm -it \
-e BOARD \
-v $MARLIN_FIRMWARE:/home/platformio/build \
-v $MARLIN_CONFIGURATION:/home/platformio/CustomConfiguration \
frealmyr/marlin-build:latest
You can create a github action that automatically builds and pushes the firmware file when you make a commit containing changes in your CustomConfiguration files.
Simply copy the github-action.yml file provided in Examples/ to .github/workflows/ in your personal repository.
You can alter the folders to your liking. I recommend adding your *.h configuration files to a folder named Firmware/Configuration, and use Firmware/builds for the compiled firmware output. If you make changes to the folder structure, remember to alter the monitored path in the github action yaml.
When you push a commit with configuration changes to master, you can check the yellow dot next to your commit, or navigate to the Actions to view the terminal output for the github action.
A live example of this setup is available here: https://github.com/frealmyr/3d-lab
| Variable | Description | Reqired |
|---|---|---|
| BOARD | Platformio default_envs | yes |
| UPDATE_SKIP | Skip firmware update prompt | no |
| UPDATE_FORCE | Update to latest Marlin release | no |
| USE_TAG | Compile using a specific release tag | no |
| USE_BRANCH | Compile using a branch instead of latest tag | no |
| Location inside container | Description |
|---|---|
| /home/platformio/build | Output folder for compiled firmware |
| /home/platformio/CustomConfiguration | Input folder for custom configuration |
Content type
Image
Digest
sha256:b0fae9db8…
Size
356.3 MB
Last updated
almost 4 years ago
docker pull frealmyr/marlin-build