`no-cache-filters` input
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
a8d76c070a
commit
5ffbca1432
|
@ -310,7 +310,6 @@ jobs:
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
with:
|
with:
|
||||||
version: v0.7.0
|
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
image=moby/buildkit:master
|
image=moby/buildkit:master
|
||||||
-
|
-
|
||||||
|
@ -332,7 +331,6 @@ jobs:
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
with:
|
with:
|
||||||
version: v0.7.0
|
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
image=moby/buildkit:master
|
image=moby/buildkit:master
|
||||||
-
|
-
|
||||||
|
@ -356,7 +354,6 @@ jobs:
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
with:
|
with:
|
||||||
version: v0.7.0
|
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
image=moby/buildkit:master
|
image=moby/buildkit:master
|
||||||
-
|
-
|
||||||
|
@ -397,8 +394,6 @@ jobs:
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
with:
|
|
||||||
version: v0.8.0
|
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
|
@ -409,6 +404,26 @@ jobs:
|
||||||
alpine=docker-image://debian:stable-slim
|
alpine=docker-image://debian:stable-slim
|
||||||
tags: name/app:latest
|
tags: name/app:latest
|
||||||
|
|
||||||
|
no-cache-filters:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
context: ./test
|
||||||
|
file: ./test/nocachefilter.Dockerfile
|
||||||
|
no-cache-filters: build
|
||||||
|
tags: name/app:latest
|
||||||
|
cache-from: type=gha,scope=nocachefilter
|
||||||
|
cache-to: type=gha,scope=nocachefilter,mode=max
|
||||||
|
|
||||||
multi:
|
multi:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -506,7 +521,6 @@ jobs:
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
with:
|
with:
|
||||||
version: v0.8.0
|
|
||||||
driver: ${{ matrix.driver }}
|
driver: ${{ matrix.driver }}
|
||||||
driver-opts: |
|
driver-opts: |
|
||||||
network=host
|
network=host
|
||||||
|
|
67
README.md
67
README.md
|
@ -197,44 +197,45 @@ Following inputs can be used as `step.with` keys
|
||||||
> tags: name/app:latest,name/app:1.0.0
|
> tags: name/app:latest,name/app:1.0.0
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|---------------------|----------|------------------------------------|
|
|--------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `add-hosts` | List/CSV | List of [customs host-to-IP mapping](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) (e.g., `docker:10.180.0.1`) |
|
| `add-hosts` | List/CSV | List of [customs host-to-IP mapping](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) (e.g., `docker:10.180.0.1`) |
|
||||||
| `allow` | List/CSV | List of [extra privileged entitlement](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#allow) (e.g., `network.host,security.insecure`) |
|
| `allow` | List/CSV | List of [extra privileged entitlement](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#allow) (e.g., `network.host,security.insecure`) |
|
||||||
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
|
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
|
||||||
| `build-args` | List | List of [build-time variables](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#build-arg) |
|
| `build-args` | List | List of [build-time variables](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#build-arg) |
|
||||||
| `build-contexts` | List | List of additional [build contexts](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#build-context) (e.g., `name=path`) |
|
| `build-contexts` | List | List of additional [build contexts](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#build-context) (e.g., `name=path`) |
|
||||||
| `cache-from` | List | List of [external cache sources](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-from) (e.g., `type=local,src=path/to/dir`) |
|
| `cache-from` | List | List of [external cache sources](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-from) (e.g., `type=local,src=path/to/dir`) |
|
||||||
| `cache-to` | List | List of [cache export destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-to) (e.g., `type=local,dest=path/to/dir`) |
|
| `cache-to` | List | List of [cache export destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-to) (e.g., `type=local,dest=path/to/dir`) |
|
||||||
| `cgroup-parent` | String | Optional [parent cgroup](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) for the container used in the build |
|
| `cgroup-parent` | String | Optional [parent cgroup](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) for the container used in the build |
|
||||||
| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
|
| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
|
||||||
| `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 |
|
| `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`) |
|
| `no-cache-filters` | List/CSV | Do not cache specified stages |
|
||||||
| `platforms` | List/CSV | List of [target platforms](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#platform) for build |
|
| `outputs` | List | List of [output destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#output) (format: `type=local,dest=path`) |
|
||||||
| `pull` | Bool | Always attempt to pull all referenced images (default `false`) |
|
| `platforms` | List/CSV | List of [target platforms](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#platform) for build |
|
||||||
| `push` | Bool | [Push](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#push) is a shorthand for `--output=type=registry` (default `false`) |
|
| `pull` | Bool | Always attempt to pull all referenced images (default `false`) |
|
||||||
| `secrets` | List | List of [secrets](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#secret) to expose to the build (e.g., `key=string`, `GIT_AUTH_TOKEN=mytoken`) |
|
| `push` | Bool | [Push](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#push) is a shorthand for `--output=type=registry` (default `false`) |
|
||||||
| `secret-files` | List | List of [secret files](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#secret) to expose to the build (e.g., `key=filename`, `MY_SECRET=./secret.txt`) |
|
| `secrets` | List | List of [secrets](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#secret) to expose to the build (e.g., `key=string`, `GIT_AUTH_TOKEN=mytoken`) |
|
||||||
| `shm-size` | String | Size of [`/dev/shm`](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#-size-of-devshm---shm-size) (e.g., `2g`) |
|
| `secret-files` | List | List of [secret files](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#secret) to expose to the build (e.g., `key=filename`, `MY_SECRET=./secret.txt`) |
|
||||||
| `ssh` | List | List of [SSH agent socket or keys](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#ssh) to expose to the build |
|
| `shm-size` | String | Size of [`/dev/shm`](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#-size-of-devshm---shm-size) (e.g., `2g`) |
|
||||||
| `tags` | List/CSV | List of tags |
|
| `ssh` | List | List of [SSH agent socket or keys](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#ssh) to expose to the build |
|
||||||
| `target` | String | Sets the target stage to build |
|
| `tags` | List/CSV | List of tags |
|
||||||
| `ulimit` | List | [Ulimit](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#-set-ulimits---ulimit) options (e.g., `nofile=1024:1024`) |
|
| `target` | String | Sets the target stage to build |
|
||||||
| `github-token` | String | GitHub Token used to authenticate against a repository for [Git context](#git-context) (default `${{ github.token }}`) |
|
| `ulimit` | List | [Ulimit](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#-set-ulimits---ulimit) options (e.g., `nofile=1024:1024`) |
|
||||||
|
| `github-token` | String | GitHub Token used to authenticate against a repository for [Git context](#git-context) (default `${{ github.token }}`) |
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
Following outputs are available
|
Following outputs are available
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|-------------------|---------|---------------------------------------|
|
|------------|---------|-----------------------------------------|
|
||||||
| `imageid` | String | Image ID |
|
| `imageid` | String | Image ID |
|
||||||
| `digest` | String | Image digest |
|
| `digest` | String | Image digest |
|
||||||
| `metadata` | JSON | Build result metadata |
|
| `metadata` | JSON | Build result metadata |
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,9 @@ inputs:
|
||||||
description: "Do not use cache when building the image"
|
description: "Do not use cache when building the image"
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
no-cache-filters:
|
||||||
|
description: "Do not cache specified stages"
|
||||||
|
required: false
|
||||||
outputs:
|
outputs:
|
||||||
description: "List of output destinations (format: type=local,dest=path)"
|
description: "List of output destinations (format: type=local,dest=path)"
|
||||||
required: false
|
required: false
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -28,6 +28,7 @@ export interface Inputs {
|
||||||
load: boolean;
|
load: boolean;
|
||||||
network: string;
|
network: string;
|
||||||
noCache: boolean;
|
noCache: boolean;
|
||||||
|
noCacheFilters: string[];
|
||||||
outputs: string[];
|
outputs: string[];
|
||||||
platforms: string[];
|
platforms: string[];
|
||||||
pull: boolean;
|
pull: boolean;
|
||||||
|
@ -83,6 +84,7 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
|
||||||
load: core.getBooleanInput('load'),
|
load: core.getBooleanInput('load'),
|
||||||
network: core.getInput('network'),
|
network: core.getInput('network'),
|
||||||
noCache: core.getBooleanInput('no-cache'),
|
noCache: core.getBooleanInput('no-cache'),
|
||||||
|
noCacheFilters: await getInputList('no-cache-filters'),
|
||||||
outputs: await getInputList('outputs', true),
|
outputs: await getInputList('outputs', true),
|
||||||
platforms: await getInputList('platforms'),
|
platforms: await getInputList('platforms'),
|
||||||
pull: core.getBooleanInput('pull'),
|
pull: core.getBooleanInput('pull'),
|
||||||
|
@ -141,6 +143,9 @@ async function getBuildArgs(inputs: Inputs, defaultContext: string, buildxVersio
|
||||||
await asyncForEach(inputs.labels, async label => {
|
await asyncForEach(inputs.labels, async label => {
|
||||||
args.push('--label', label);
|
args.push('--label', label);
|
||||||
});
|
});
|
||||||
|
await asyncForEach(inputs.noCacheFilters, async noCacheFilter => {
|
||||||
|
args.push('--no-cache-filter', noCacheFilter);
|
||||||
|
});
|
||||||
await asyncForEach(inputs.outputs, async output => {
|
await asyncForEach(inputs.outputs, async output => {
|
||||||
args.push('--output', output);
|
args.push('--output', output);
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
FROM busybox AS base
|
||||||
|
RUN echo "Hello world!" > /hello
|
||||||
|
|
||||||
|
FROM alpine AS build
|
||||||
|
COPY --from=base /hello /hello
|
||||||
|
RUN uname -a
|
||||||
|
|
||||||
|
FROM build
|
Loading…
Reference in New Issue