Summary
Add an optional input to specify the target platform(s) for the Docker image build, threaded through to the platforms: field of the docker/build-push-action@v6 step. The default would be empty, so the action omits platforms: entirely and builds for the runner's native architecture exactly as it does today — no behaviour change for existing users.
Motivation
Currently the Docker build (action.yml, the "🐳🚀 Build and Push to Docker Registry" step) sets no platforms: field, so every image is built only for the GitHub runner's native arch (linux/amd64). Users who want multi-arch images — e.g. linux/arm64 for Apple Silicon / ARM servers — have no way to request them without forking the action.
Proposed change
- New action input (
action.yml), default empty:
docker_platforms:
description: >
Comma-separated platforms to build the Docker image for, e.g.
'linux/amd64,linux/arm64'. Leave empty (default) to build only for the
runner's native architecture.
default: ''
- Conditionally pass it to the build step (
action.yml:704-721):
platforms: ${{ inputs.docker_platforms }}
An empty string here is treated by build-push-action as "no platforms set", so the default reproduces current behaviour.
- Thread the parameter through the R generators so it lands in user workflows:
R/use_workflow.R (add docker_platforms alongside the other docker_* args)
R/fill_yaml.R (add to the with2/arg list)
inst/templates/rworkflows_template.yml with: block
- keep
.github/workflows/rworkflows_static.yml in sync
Notes / caveats
- Cross-building
linux/arm64 on an amd64 runner requires docker/setup-qemu-action@v3 before the build step. We should add it (it's a no-op when only the native platform is built).
- Multi-platform images can't be loaded into the local daemon, only pushed — fine here since the step already uses
push: true.
cache-from/cache-to: type=gha remain compatible with multi-platform builds.
Backward compatibility
Fully backward compatible: empty default ⇒ no platforms: ⇒ identical to the current single-arch build.
Summary
Add an optional input to specify the target platform(s) for the Docker image build, threaded through to the
platforms:field of thedocker/build-push-action@v6step. The default would be empty, so the action omitsplatforms:entirely and builds for the runner's native architecture exactly as it does today — no behaviour change for existing users.Motivation
Currently the Docker build (
action.yml, the "🐳🚀 Build and Push to Docker Registry" step) sets noplatforms:field, so every image is built only for the GitHub runner's native arch (linux/amd64). Users who want multi-arch images — e.g.linux/arm64for Apple Silicon / ARM servers — have no way to request them without forking the action.Proposed change
action.yml), default empty:action.yml:704-721):build-push-actionas "no platforms set", so the default reproduces current behaviour.R/use_workflow.R(adddocker_platformsalongside the otherdocker_*args)R/fill_yaml.R(add to thewith2/arg list)inst/templates/rworkflows_template.ymlwith:block.github/workflows/rworkflows_static.ymlin syncNotes / caveats
linux/arm64on an amd64 runner requiresdocker/setup-qemu-action@v3before the build step. We should add it (it's a no-op when only the native platform is built).push: true.cache-from/cache-to: type=gharemain compatible with multi-platform builds.Backward compatibility
Fully backward compatible: empty default ⇒ no
platforms:⇒ identical to the current single-arch build.