mirror of
https://github.com/docker/build-push-action.git
synced 2024-12-25 00:02:13 -05:00
Add driver and driver-opt inputs for setup-buildx
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
4bde7b156d
commit
5cec6ce786
8 changed files with 80 additions and 19 deletions
40
.github/workflows/setup-buildx-ci.yml
vendored
40
.github/workflows/setup-buildx-ci.yml
vendored
|
@ -15,7 +15,7 @@ on:
|
|||
- setup-buildx/**
|
||||
|
||||
jobs:
|
||||
build:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -62,6 +62,44 @@ jobs:
|
|||
run: |
|
||||
docker build --help
|
||||
|
||||
driver:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
driver:
|
||||
- docker-container
|
||||
- docker
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2.3.1
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: ./setup-buildx/
|
||||
with:
|
||||
driver: ${{ matrix.driver }}
|
||||
|
||||
driver-opt:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
driver-opt:
|
||||
- image=moby/buildkit:latest
|
||||
- image=moby/buildkit:master
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2.3.1
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: ./setup-buildx/
|
||||
with:
|
||||
driver-opt: ${{ matrix.driver-opt }}
|
||||
|
||||
with-qemu:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
|
2
.github/workflows/setup-qemu-ci.yml
vendored
2
.github/workflows/setup-qemu-ci.yml
vendored
|
@ -15,7 +15,7 @@ on:
|
|||
- setup-qemu/**
|
||||
|
||||
jobs:
|
||||
build:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
|
|
@ -88,10 +88,12 @@ jobs:
|
|||
|
||||
Following inputs can be used as `step.with` keys
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|------------------|---------|-----------|------------------------------------|
|
||||
| `buildx-version` | String | `latest` | [Buildx](https://github.com/docker/buildx) version. Example: `v0.3.0` |
|
||||
| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |
|
||||
| Name | Type | Default | Description |
|
||||
|------------------|---------|---------------------|------------------------------------|
|
||||
| `buildx-version` | String | `latest` | [Buildx](https://github.com/docker/buildx) version. e.g. `v0.3.0` |
|
||||
| `driver` | String | `docker-container` | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used. |
|
||||
| `driver-opt` | String | | Passes additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options). e.g. `image=moby/buildkit:master` |
|
||||
| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |
|
||||
|
||||
### outputs
|
||||
|
||||
|
|
|
@ -8,9 +8,16 @@ branding:
|
|||
|
||||
inputs:
|
||||
buildx-version:
|
||||
description: 'Buildx version. Example: v0.3.0'
|
||||
description: 'Buildx version. e.g. v0.3.0'
|
||||
default: 'latest'
|
||||
required: false
|
||||
driver:
|
||||
description: 'Sets the builder driver to be used'
|
||||
default: 'docker-container'
|
||||
required: false
|
||||
driver-opt:
|
||||
description: 'Passes additional driver-specific options. Eg. image=moby/buildkit:master'
|
||||
required: false
|
||||
install:
|
||||
description: 'Sets up docker build command as an alias to docker buildx'
|
||||
default: 'false'
|
||||
|
|
14
setup-buildx/dist/index.js
generated
vendored
14
setup-buildx/dist/index.js
generated
vendored
|
@ -2492,21 +2492,27 @@ function run() {
|
|||
return;
|
||||
}
|
||||
const buildxVer = core.getInput('buildx-version') || 'latest';
|
||||
const driver = core.getInput('driver') || 'docker-container';
|
||||
const driverOpt = core.getInput('driver-opt');
|
||||
const install = /true/i.test(core.getInput('install'));
|
||||
const dockerConfigHome = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
||||
yield installer.buildx(buildxVer, dockerConfigHome);
|
||||
core.info('📣 Buildx info');
|
||||
yield exec.exec('docker', ['buildx', 'version']);
|
||||
core.info('🔨 Creating a new builder instance...');
|
||||
yield exec.exec('docker', [
|
||||
let createArgs = [
|
||||
'buildx',
|
||||
'create',
|
||||
'--use',
|
||||
'--name',
|
||||
`builder-${process.env.GITHUB_SHA}`,
|
||||
'--driver',
|
||||
'docker-container',
|
||||
'--use'
|
||||
]);
|
||||
driver
|
||||
];
|
||||
if (driverOpt) {
|
||||
createArgs.push('--driver-opt', driverOpt);
|
||||
}
|
||||
yield exec.exec('docker', createArgs);
|
||||
core.info('🏃 Booting builder...');
|
||||
yield exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
||||
if (install) {
|
||||
|
|
|
@ -14,6 +14,8 @@ async function run(): Promise<void> {
|
|||
}
|
||||
|
||||
const buildxVer: string = core.getInput('buildx-version') || 'latest';
|
||||
const driver: string = core.getInput('driver') || 'docker-container';
|
||||
const driverOpt: string = core.getInput('driver-opt');
|
||||
const install: boolean = /true/i.test(core.getInput('install'));
|
||||
const dockerConfigHome: string = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
||||
await installer.buildx(buildxVer, dockerConfigHome);
|
||||
|
@ -22,15 +24,21 @@ async function run(): Promise<void> {
|
|||
await exec.exec('docker', ['buildx', 'version']);
|
||||
|
||||
core.info('🔨 Creating a new builder instance...');
|
||||
await exec.exec('docker', [
|
||||
let createArgs: Array<string> = [
|
||||
'buildx',
|
||||
'create',
|
||||
'--use',
|
||||
'--name',
|
||||
`builder-${process.env.GITHUB_SHA}`,
|
||||
'--driver',
|
||||
'docker-container',
|
||||
'--use'
|
||||
]);
|
||||
driver
|
||||
];
|
||||
|
||||
if (driverOpt) {
|
||||
createArgs.push('--driver-opt', driverOpt);
|
||||
}
|
||||
|
||||
await exec.exec('docker', createArgs);
|
||||
|
||||
core.info('🏃 Booting builder...');
|
||||
await exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
||||
|
|
|
@ -48,8 +48,8 @@ Following inputs can be used as `step.with` keys
|
|||
|
||||
| Name | Type | Default | Description |
|
||||
|------------------|---------|-----------------------------|------------------------------------|
|
||||
| `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` |
|
||||
| `image` | String | `tonistiigi/binfmt:latest` | QEMU static binaries Docker image. e.g. [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags) |
|
||||
| `platforms` | String | `all` | Platforms to install. e.g. `arm64,riscv64,arm` |
|
||||
|
||||
### outputs
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ branding:
|
|||
|
||||
inputs:
|
||||
image:
|
||||
description: 'QEMU static binaries Docker image. Example: tonistiigi/binfmt:latest'
|
||||
description: 'QEMU static binaries Docker image. e.g. tonistiigi/binfmt:latest'
|
||||
default: 'tonistiigi/binfmt:latest'
|
||||
required: false
|
||||
platforms:
|
||||
description: 'Platforms to install. Example: arm64,riscv64,arm'
|
||||
description: 'Platforms to install. e.g. arm64,riscv64,arm'
|
||||
default: 'all'
|
||||
required: false
|
||||
|
||||
|
|
Loading…
Reference in a new issue