mirror of
https://github.com/docker/setup-buildx-action.git
synced 2024-12-23 02:47:43 +01:00
Merge pull request #18 from crazy-max/add-context-input
Add context input (#16)
This commit is contained in:
commit
fbadcae980
BIN
.github/setup-buildx-action.png
vendored
BIN
.github/setup-buildx-action.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
33
.github/workflows/ci.yml
vendored
33
.github/workflows/ci.yml
vendored
@ -143,6 +143,39 @@ jobs:
|
|||||||
docker buildx inspect | grep Driver | grep docker
|
docker buildx inspect | grep Driver | grep docker
|
||||||
docker buildx inspect | grep Status | grep running
|
docker buildx inspect | grep Status | grep running
|
||||||
|
|
||||||
|
endpoint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
dind:
|
||||||
|
image: docker:dind
|
||||||
|
options: >-
|
||||||
|
--privileged
|
||||||
|
--health-cmd "docker info"
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
env:
|
||||||
|
DOCKER_TLS_CERTDIR: ""
|
||||||
|
ports:
|
||||||
|
- 2375:2375
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2.3.2
|
||||||
|
-
|
||||||
|
name: Create context
|
||||||
|
run: |
|
||||||
|
docker context create mycontext --docker host=tcp://127.0.0.1:2375
|
||||||
|
-
|
||||||
|
name: Check context
|
||||||
|
run: |
|
||||||
|
docker --context mycontext info
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
endpoint: mycontext
|
||||||
|
|
||||||
with-qemu:
|
with-qemu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -128,12 +128,13 @@ Following inputs can be used as `step.with` keys
|
|||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|--------------------|---------|-----------------------------------|
|
|--------------------|---------|-----------------------------------|
|
||||||
| `version` | String | [Buildx](https://github.com/docker/buildx) version. (e.g. `v0.3.0`, `latest`) |
|
| `version` | String | [Buildx](https://github.com/docker/buildx) version. (eg. `v0.3.0`, `latest`) |
|
||||||
| `driver` | String | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used (default `docker-container`) |
|
| `driver` | String | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used (default `docker-container`) |
|
||||||
| `driver-opts` | CSV | List of additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options) |
|
| `driver-opts` | CSV | List of additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options) (eg. `image=moby/buildkit:master`) |
|
||||||
| `buildkitd-flags` | String | [Flags for buildkitd](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md) daemon (since [buildx v0.3.0](https://github.com/docker/buildx/releases/tag/v0.3.0)) |
|
| `buildkitd-flags` | String | [Flags for buildkitd](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md) daemon (since [buildx v0.3.0](https://github.com/docker/buildx/releases/tag/v0.3.0)) |
|
||||||
| `install` | Bool | Sets up `docker build` command as an alias to `docker buildx` (default `false`) |
|
| `install` | Bool | Sets up `docker build` command as an alias to `docker buildx` (default `false`) |
|
||||||
| `use` | Bool | Switch to this builder instance (default `true`) |
|
| `use` | Bool | Switch to this builder instance (default `true`) |
|
||||||
|
| `endpoint` | String | [Optional address for docker socket](https://github.com/docker/buildx#buildx-create-options-contextendpoint) or context from `docker context ls` |
|
||||||
|
|
||||||
> `CSV` type must be a newline-delimited string
|
> `CSV` type must be a newline-delimited string
|
||||||
> ```yaml
|
> ```yaml
|
||||||
|
@ -8,14 +8,14 @@ branding:
|
|||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: 'Buildx version. e.g. v0.3.0'
|
description: 'Buildx version. (eg. v0.3.0)'
|
||||||
required: false
|
required: false
|
||||||
driver:
|
driver:
|
||||||
description: 'Sets the builder driver to be used'
|
description: 'Sets the builder driver to be used'
|
||||||
default: 'docker-container'
|
default: 'docker-container'
|
||||||
required: false
|
required: false
|
||||||
driver-opts:
|
driver-opts:
|
||||||
description: 'List of additional driver-specific options. Eg. image=moby/buildkit:master'
|
description: 'List of additional driver-specific options. (eg. image=moby/buildkit:master)'
|
||||||
required: false
|
required: false
|
||||||
buildkitd-flags:
|
buildkitd-flags:
|
||||||
description: 'Flags for buildkitd daemon'
|
description: 'Flags for buildkitd daemon'
|
||||||
@ -29,6 +29,9 @@ inputs:
|
|||||||
description: 'Switch to this builder instance'
|
description: 'Switch to this builder instance'
|
||||||
default: 'true'
|
default: 'true'
|
||||||
required: false
|
required: false
|
||||||
|
endpoint:
|
||||||
|
description: 'Optional address for docker socket or context from `docker context ls`'
|
||||||
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
name:
|
name:
|
||||||
|
6
dist/index.js
generated
vendored
6
dist/index.js
generated
vendored
@ -534,6 +534,9 @@ function run() {
|
|||||||
if (inputs.use) {
|
if (inputs.use) {
|
||||||
createArgs.push('--use');
|
createArgs.push('--use');
|
||||||
}
|
}
|
||||||
|
if (inputs.endpoint) {
|
||||||
|
createArgs.push(inputs.endpoint);
|
||||||
|
}
|
||||||
yield exec.exec('docker', createArgs);
|
yield exec.exec('docker', createArgs);
|
||||||
core.info('🏃 Booting builder...');
|
core.info('🏃 Booting builder...');
|
||||||
yield exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
yield exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
||||||
@ -6577,7 +6580,8 @@ function getInputs() {
|
|||||||
buildkitdFlags: core.getInput('buildkitd-flags') ||
|
buildkitdFlags: core.getInput('buildkitd-flags') ||
|
||||||
'--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
'--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
||||||
install: /true/i.test(core.getInput('install')),
|
install: /true/i.test(core.getInput('install')),
|
||||||
use: /true/i.test(core.getInput('use'))
|
use: /true/i.test(core.getInput('use')),
|
||||||
|
endpoint: core.getInput('endpoint')
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ export interface Inputs {
|
|||||||
buildkitdFlags: string;
|
buildkitdFlags: string;
|
||||||
install: boolean;
|
install: boolean;
|
||||||
use: boolean;
|
use: boolean;
|
||||||
|
endpoint: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getInputs(): Promise<Inputs> {
|
export async function getInputs(): Promise<Inputs> {
|
||||||
@ -22,7 +23,8 @@ export async function getInputs(): Promise<Inputs> {
|
|||||||
core.getInput('buildkitd-flags') ||
|
core.getInput('buildkitd-flags') ||
|
||||||
'--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
'--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
||||||
install: /true/i.test(core.getInput('install')),
|
install: /true/i.test(core.getInput('install')),
|
||||||
use: /true/i.test(core.getInput('use'))
|
use: /true/i.test(core.getInput('use')),
|
||||||
|
endpoint: core.getInput('endpoint')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,9 @@ async function run(): Promise<void> {
|
|||||||
if (inputs.use) {
|
if (inputs.use) {
|
||||||
createArgs.push('--use');
|
createArgs.push('--use');
|
||||||
}
|
}
|
||||||
|
if (inputs.endpoint) {
|
||||||
|
createArgs.push(inputs.endpoint);
|
||||||
|
}
|
||||||
await exec.exec('docker', createArgs);
|
await exec.exec('docker', createArgs);
|
||||||
|
|
||||||
core.info('🏃 Booting builder...');
|
core.info('🏃 Booting builder...');
|
||||||
|
Loading…
Reference in New Issue
Block a user