Simple Docker image for building with PlatformIO.
v<version>-dev— built frommain, e.g.v6.1.19-devv<version>— promoted release, e.g.v6.1.19latest— most recently promoted release
- Pass
PUIDandPGIDat runtime (or use the wrapper) to match the host user. Defaults (1001:121) align with GitHub Actions. - Clone some source code
- Mount source inside container as
/work - (Optional) Persist caches through named or host-mounted volumes:
- PlatformIO at
/home/pio/.platformio - Builder (npm) cache at
/home/pio/.platformio-builder
- PlatformIO at
- Run one-off
piobuilds/commands via ephemeral containers orbashto get an interactive shell and mess about
$ git clone https://github.com/MoonModules/WLED-MM.git
$ export PIO_BUILDER_CACHE_KEY="$(basename "$PWD")"
$ docker run --rm $([ -t 0 ] && echo '-t') $([[ "$-" =~ 'i' ]] && echo '-i') \
--pull always \
-e PUID="$(id -u)" \
-e PGID="$(id -g)" \
-v "$HOME/.platformio:/home/pio/.platformio" \
-v "$HOME/.platformio-builder/$PIO_BUILDER_CACHE_KEY:/home/pio/.platformio-builder" \
-v "$HOME/.platformio-builder/$PIO_BUILDER_CACHE_KEY/node_modules:/work/node_modules" \
-v "${GITHUB_WORKSPACE:-$PWD}/WLED-MM:/work" \
-w /work \
ghcr.io/treyturner/platformio-builder:latest \
pio --version
PlatformIO Core, version 6.1.19A wrapper with the above logic can be tweaked to your needs. Set PIO_BUILDER_TAG to pin a specific version:
PIO_BUILDER_TAG=v6.1.19 ./with_builder.sh pio runBuild locally (queries PyPI for the latest PlatformIO version):
make buildPin a specific PlatformIO version:
PLATFORMIO_VERSION=6.1.19 make buildPushing to main triggers the Build and publish dev workflow, which detects the latest PlatformIO version from PyPI and publishes a v<version>-dev image.
To build with a specific PlatformIO version, trigger the workflow manually and supply the platformio_version input.
Run the Promote dev version tag to release version tag workflow with:
| Input | Description |
|---|---|
platformio_version |
Version to promote, e.g. 6.1.19 |
latest |
If enabled, also retag the image as latest |
This promotes v<version>-dev → v<version> (and optionally latest).