mirror of
https://github.com/docker/build-push-action.git
synced 2024-11-23 11:29:02 +00:00
Add network input
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
8891861577
commit
5a4a26c0fc
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@ -290,6 +290,30 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
uses: crazy-max/ghaction-dump-context@v1
|
uses: crazy-max/ghaction-dump-context@v1
|
||||||
|
|
||||||
|
network:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: List networks
|
||||||
|
run: docker network ls
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
context: ./test
|
||||||
|
tags: name/app:latest
|
||||||
|
network: host
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
if: always()
|
||||||
|
uses: crazy-max/ghaction-dump-context@v1
|
||||||
|
|
||||||
multi:
|
multi:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -204,6 +204,7 @@ Following inputs can be used as `step.with` keys
|
|||||||
| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) |
|
| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) |
|
||||||
| `labels` | List | List of metadata for an image |
|
| `labels` | List | List of metadata for an image |
|
||||||
| `load` | Bool | [Load](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#load) is a shorthand for `--output=type=docker` (default `false`) |
|
| `load` | Bool | [Load](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#load) is a shorthand for `--output=type=docker` (default `false`) |
|
||||||
|
| `network` | String | Set the networking mode for the `RUN` instructions during build |
|
||||||
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
|
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
|
||||||
| `outputs` | List | List of [output destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#output) (format: `type=local,dest=path`) |
|
| `outputs` | List | List of [output destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#output) (format: `type=local,dest=path`) |
|
||||||
| `platforms` | List/CSV | List of [target platforms](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#platform) for build |
|
| `platforms` | List/CSV | List of [target platforms](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#platform) for build |
|
||||||
|
@ -346,6 +346,7 @@ ccc`],
|
|||||||
['secret-files', `MY_SECRET=${path.join(__dirname, 'fixtures', 'secret.txt').split(path.sep).join(path.posix.sep)}`],
|
['secret-files', `MY_SECRET=${path.join(__dirname, 'fixtures', 'secret.txt').split(path.sep).join(path.posix.sep)}`],
|
||||||
['file', './test/Dockerfile'],
|
['file', './test/Dockerfile'],
|
||||||
['builder', 'builder-git-context-2'],
|
['builder', 'builder-git-context-2'],
|
||||||
|
['network', 'host'],
|
||||||
['push', 'true']
|
['push', 'true']
|
||||||
]),
|
]),
|
||||||
[
|
[
|
||||||
@ -355,6 +356,7 @@ ccc`],
|
|||||||
'--secret', 'id=MY_SECRET,src=/tmp/.docker-build-push-jest/.tmpname-jest',
|
'--secret', 'id=MY_SECRET,src=/tmp/.docker-build-push-jest/.tmpname-jest',
|
||||||
'--file', './test/Dockerfile',
|
'--file', './test/Dockerfile',
|
||||||
'--builder', 'builder-git-context-2',
|
'--builder', 'builder-git-context-2',
|
||||||
|
'--network', 'host',
|
||||||
'--push',
|
'--push',
|
||||||
'https://github.com/docker/build-push-action.git#heads/master'
|
'https://github.com/docker/build-push-action.git#heads/master'
|
||||||
]
|
]
|
||||||
|
@ -35,6 +35,9 @@ inputs:
|
|||||||
description: "Load is a shorthand for --output=type=docker"
|
description: "Load is a shorthand for --output=type=docker"
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
network:
|
||||||
|
description: "Set the networking mode for the RUN instructions during build"
|
||||||
|
required: false
|
||||||
no-cache:
|
no-cache:
|
||||||
description: "Do not use cache when building the image"
|
description: "Do not use cache when building the image"
|
||||||
required: false
|
required: false
|
||||||
|
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
@ -13042,6 +13042,7 @@ function getInputs(defaultContext) {
|
|||||||
file: core.getInput('file'),
|
file: core.getInput('file'),
|
||||||
labels: yield getInputList('labels', true),
|
labels: yield getInputList('labels', true),
|
||||||
load: /true/i.test(core.getInput('load')),
|
load: /true/i.test(core.getInput('load')),
|
||||||
|
network: core.getInput('network'),
|
||||||
noCache: /true/i.test(core.getInput('no-cache')),
|
noCache: /true/i.test(core.getInput('no-cache')),
|
||||||
outputs: yield getInputList('outputs', true),
|
outputs: yield getInputList('outputs', true),
|
||||||
platforms: yield getInputList('platforms'),
|
platforms: yield getInputList('platforms'),
|
||||||
@ -13144,6 +13145,9 @@ function getCommonArgs(inputs) {
|
|||||||
if (inputs.load) {
|
if (inputs.load) {
|
||||||
args.push('--load');
|
args.push('--load');
|
||||||
}
|
}
|
||||||
|
if (inputs.network) {
|
||||||
|
args.push('--network', inputs.network);
|
||||||
|
}
|
||||||
if (inputs.push) {
|
if (inputs.push) {
|
||||||
args.push('--push');
|
args.push('--push');
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ export interface Inputs {
|
|||||||
file: string;
|
file: string;
|
||||||
labels: string[];
|
labels: string[];
|
||||||
load: boolean;
|
load: boolean;
|
||||||
|
network: string;
|
||||||
noCache: boolean;
|
noCache: boolean;
|
||||||
outputs: string[];
|
outputs: string[];
|
||||||
platforms: string[];
|
platforms: string[];
|
||||||
@ -66,6 +67,7 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
|
|||||||
file: core.getInput('file'),
|
file: core.getInput('file'),
|
||||||
labels: await getInputList('labels', true),
|
labels: await getInputList('labels', true),
|
||||||
load: /true/i.test(core.getInput('load')),
|
load: /true/i.test(core.getInput('load')),
|
||||||
|
network: core.getInput('network'),
|
||||||
noCache: /true/i.test(core.getInput('no-cache')),
|
noCache: /true/i.test(core.getInput('no-cache')),
|
||||||
outputs: await getInputList('outputs', true),
|
outputs: await getInputList('outputs', true),
|
||||||
platforms: await getInputList('platforms'),
|
platforms: await getInputList('platforms'),
|
||||||
@ -163,6 +165,9 @@ async function getCommonArgs(inputs: Inputs): Promise<Array<string>> {
|
|||||||
if (inputs.load) {
|
if (inputs.load) {
|
||||||
args.push('--load');
|
args.push('--load');
|
||||||
}
|
}
|
||||||
|
if (inputs.network) {
|
||||||
|
args.push('--network', inputs.network);
|
||||||
|
}
|
||||||
if (inputs.push) {
|
if (inputs.push) {
|
||||||
args.push('--push');
|
args.push('--push');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user