mirror of
https://github.com/docker/build-push-action
synced 2024-11-23 02:31:41 +00:00
Switch to tonistiigi/binfmt
Add platforms input to choose what platforms to install Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
7e439a0132
commit
b943609390
5 changed files with 27 additions and 35 deletions
12
.github/workflows/setup-qemu-ci.yml
vendored
12
.github/workflows/setup-qemu-ci.yml
vendored
|
@ -16,9 +16,12 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
qemu-version:
|
||||
- latest
|
||||
- 4.2.0-7
|
||||
image:
|
||||
- tonistiigi/binfmt:latest
|
||||
- tonistiigi/binfmt:buildkit
|
||||
platforms:
|
||||
- all
|
||||
- arm64,riscv64,arm
|
||||
steps:
|
||||
-
|
||||
name: Runner info
|
||||
|
@ -33,4 +36,5 @@ jobs:
|
|||
name: Set up QEMU
|
||||
uses: ./setup-qemu/
|
||||
with:
|
||||
qemu-version: ${{ matrix.qemu-version }}
|
||||
image: ${ matrix.image }
|
||||
platforms: ${ matrix.platforms }
|
||||
|
|
|
@ -32,7 +32,8 @@ jobs:
|
|||
name: Set up QEMU
|
||||
uses: docker/actions/setup-qemu@v2
|
||||
with:
|
||||
qemu-version: latest
|
||||
image: tonistiigi/binfmt:latest
|
||||
platforms: all
|
||||
```
|
||||
|
||||
## Customizing
|
||||
|
@ -42,8 +43,9 @@ jobs:
|
|||
Following inputs can be used as `step.with` keys
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|------------------|---------|-----------|------------------------------------|
|
||||
| `qemu-version` | String | `latest` | [qemu-user-static](https://github.com/multiarch/qemu-user-static) version (Docker tag). Example: `4.2.0-7` |
|
||||
|------------------|---------|-----------------------------|------------------------------------|
|
||||
| `image` | String | `tonistiigi/binfmt:latest` | QEMU static binaries Docker image. Example: [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags) |
|
||||
| `platforms` | String | `all` | Platforms to install. Example: `arm64,riscv64,arm` |
|
||||
|
||||
## Limitation
|
||||
|
||||
|
|
|
@ -7,9 +7,13 @@ branding:
|
|||
icon: 'truck'
|
||||
|
||||
inputs:
|
||||
qemu-version:
|
||||
description: 'QEMU static binaries Docker image version. Example: 4.2.0-7'
|
||||
default: 'latest'
|
||||
image:
|
||||
description: 'QEMU static binaries Docker image. Example: tonistiigi/binfmt:latest'
|
||||
default: 'tonistiigi/binfmt:latest'
|
||||
required: false
|
||||
platforms:
|
||||
description: 'Platforms to install. Example: arm64,riscv64,arm'
|
||||
default: 'all'
|
||||
required: false
|
||||
|
||||
runs:
|
||||
|
|
15
setup-qemu/dist/index.js
generated
vendored
15
setup-qemu/dist/index.js
generated
vendored
|
@ -1011,19 +1011,10 @@ function run() {
|
|||
core.setFailed('Only supported on linux platform');
|
||||
return;
|
||||
}
|
||||
const qemuVer = core.getInput('qemu-version') || 'latest';
|
||||
const image = core.getInput('image') || 'tonistiigi/binfmt:latest';
|
||||
const platforms = core.getInput('platforms') || 'all';
|
||||
core.info(`💎 Installing QEMU static binaries...`);
|
||||
yield exec.exec('docker', [
|
||||
'run',
|
||||
'--rm',
|
||||
'--privileged',
|
||||
`multiarch/qemu-user-static:${qemuVer}`,
|
||||
'--reset',
|
||||
'-p',
|
||||
'yes',
|
||||
'--credential',
|
||||
'yes'
|
||||
]);
|
||||
yield exec.exec('docker', ['run', '--rm', '--privileged', image, '--install', platforms]);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
|
|
@ -9,20 +9,11 @@ async function run(): Promise<void> {
|
|||
return;
|
||||
}
|
||||
|
||||
const qemuVer: string = core.getInput('qemu-version') || 'latest';
|
||||
const image: string = core.getInput('image') || 'tonistiigi/binfmt:latest';
|
||||
const platforms: string = core.getInput('platforms') || 'all';
|
||||
|
||||
core.info(`💎 Installing QEMU static binaries...`);
|
||||
await exec.exec('docker', [
|
||||
'run',
|
||||
'--rm',
|
||||
'--privileged',
|
||||
`multiarch/qemu-user-static:${qemuVer}`,
|
||||
'--reset',
|
||||
'-p',
|
||||
'yes',
|
||||
'--credential',
|
||||
'yes'
|
||||
]);
|
||||
await exec.exec('docker', ['run', '--rm', '--privileged', image, '--install', platforms]);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue