mirror of
https://github.com/docker/build-push-action.git
synced 2024-11-15 16:23:51 +08:00
Add 'use' input
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
d0f7649930
commit
15c6a86f2d
22
.github/workflows/setup-buildx-ci.yml
vendored
22
.github/workflows/setup-buildx-ci.yml
vendored
@ -62,6 +62,28 @@ jobs:
|
||||
run: |
|
||||
docker build --help
|
||||
|
||||
use:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
use:
|
||||
- true
|
||||
- false
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2.3.1
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: ./setup-buildx/
|
||||
with:
|
||||
use: ${{ matrix.use }}
|
||||
-
|
||||
name: List builder instances
|
||||
run: docker buildx ls
|
||||
|
||||
driver:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
@ -94,6 +94,7 @@ Following inputs can be used as `step.with` keys
|
||||
| `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` |
|
||||
| `use` | Bool | `true` | Switch to this builder instance |
|
||||
|
||||
### outputs
|
||||
|
||||
|
@ -22,6 +22,10 @@ inputs:
|
||||
description: 'Sets up docker build command as an alias to docker buildx'
|
||||
default: 'false'
|
||||
required: false
|
||||
use:
|
||||
description: 'Switch to this builder instance'
|
||||
default: 'true'
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
platforms:
|
||||
|
5
setup-buildx/dist/index.js
generated
vendored
5
setup-buildx/dist/index.js
generated
vendored
@ -2495,6 +2495,7 @@ function run() {
|
||||
const driver = core.getInput('driver') || 'docker-container';
|
||||
const driverOpt = core.getInput('driver-opt');
|
||||
const install = /true/i.test(core.getInput('install'));
|
||||
const use = /true/i.test(core.getInput('use'));
|
||||
const dockerConfigHome = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
||||
yield installer.buildx(buildxVer, dockerConfigHome);
|
||||
core.info('📣 Buildx info');
|
||||
@ -2503,7 +2504,6 @@ function run() {
|
||||
let createArgs = [
|
||||
'buildx',
|
||||
'create',
|
||||
'--use',
|
||||
'--name',
|
||||
`builder-${process.env.GITHUB_SHA}`,
|
||||
'--driver',
|
||||
@ -2512,6 +2512,9 @@ function run() {
|
||||
if (driverOpt) {
|
||||
createArgs.push('--driver-opt', driverOpt);
|
||||
}
|
||||
if (use) {
|
||||
createArgs.push('--use');
|
||||
}
|
||||
yield exec.exec('docker', createArgs);
|
||||
core.info('🏃 Booting builder...');
|
||||
yield exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
||||
|
@ -17,6 +17,8 @@ async function run(): Promise<void> {
|
||||
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 use: boolean = /true/i.test(core.getInput('use'));
|
||||
|
||||
const dockerConfigHome: string = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
||||
await installer.buildx(buildxVer, dockerConfigHome);
|
||||
|
||||
@ -27,16 +29,17 @@ async function run(): Promise<void> {
|
||||
let createArgs: Array<string> = [
|
||||
'buildx',
|
||||
'create',
|
||||
'--use',
|
||||
'--name',
|
||||
`builder-${process.env.GITHUB_SHA}`,
|
||||
'--driver',
|
||||
driver
|
||||
];
|
||||
|
||||
if (driverOpt) {
|
||||
createArgs.push('--driver-opt', driverOpt);
|
||||
}
|
||||
if (use) {
|
||||
createArgs.push('--use');
|
||||
}
|
||||
|
||||
await exec.exec('docker', createArgs);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user