|
48 | 48 | * [Major version zero](#major-version-zero) |
49 | 49 | * [JSON output object](#json-output-object) |
50 | 50 | * [Overwrite labels](#overwrite-labels) |
| 51 | + * [Annotations](#annotations) |
51 | 52 | * [Contributing](#contributing) |
52 | 53 |
|
53 | 54 | ## Usage |
@@ -292,23 +293,39 @@ The following inputs can be used as `step.with` keys: |
292 | 293 |
|
293 | 294 | The following outputs are available: |
294 | 295 |
|
295 | | -| Name | Type | Description | |
296 | | -|--------------------|--------|----------------------------------------------------------------------------------------| |
297 | | -| `version` | String | Docker image version | |
298 | | -| `tags` | String | Docker tags | |
299 | | -| `labels` | String | Docker labels | |
300 | | -| `json` | String | JSON output of tags and labels | |
301 | | -| `bake-file-tags` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with tags | |
302 | | -| `bake-file-labels` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with labels | |
| 296 | +| Name | Type | Description | |
| 297 | +|---------------------------------------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 298 | +| `version` | String | Docker image version | |
| 299 | +| `tags` | String | Docker tags | |
| 300 | +| `labels` | String | Docker labels | |
| 301 | +| `annotations-index` | String | Index level [annotations](https://github.com/moby/buildkit/blob/master/docs/annotations.md) | |
| 302 | +| `annotations-index-descriptor` | String | Index descriptor level [annotations](https://github.com/moby/buildkit/blob/master/docs/annotations.md) | |
| 303 | +| `annotations-manifest` | String | Manifest level [annotations](https://github.com/moby/buildkit/blob/master/docs/annotations.md) | |
| 304 | +| `annotations-manifest-descriptor` | String | Manifest descriptor level [annotations](https://github.com/moby/buildkit/blob/master/docs/annotations.md) | |
| 305 | +| `json` | String | JSON output of tags and labels | |
| 306 | +| `bake-file-tags` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with tags | |
| 307 | +| `bake-file-labels` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with labels | |
| 308 | +| `bake-file-annotations-index` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with index level [annotations](https://github.com/moby/buildkit/blob/master/docs/annotations.md) | |
| 309 | +| `bake-file-annotations-index-descriptor` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with index descriptor level [annotations](https://github.com/moby/buildkit/blob/master/docs/annotations.md) | |
| 310 | +| `bake-file-annotations-manifest` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with manifest level [annotations](https://github.com/moby/buildkit/blob/master/docs/annotations.md) | |
| 311 | +| `bake-file-annotations-manifest-descriptor` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with manifest descriptor level [annotations](https://github.com/moby/buildkit/blob/master/docs/annotations.md) | |
303 | 312 |
|
304 | 313 | Alternatively, each output is also exported as an environment variable: |
305 | 314 |
|
306 | 315 | * `DOCKER_METADATA_OUTPUT_VERSION` |
307 | 316 | * `DOCKER_METADATA_OUTPUT_TAGS` |
308 | 317 | * `DOCKER_METADATA_OUTPUT_LABELS` |
| 318 | +* `DOCKER_METADATA_OUTPUT_ANNOTATIONS_INDEX` |
| 319 | +* `DOCKER_METADATA_OUTPUT_ANNOTATIONS_INDEX_DESCRIPTOR` |
| 320 | +* `DOCKER_METADATA_OUTPUT_ANNOTATIONS_MANIFEST` |
| 321 | +* `DOCKER_METADATA_OUTPUT_ANNOTATIONS_MANIFEST_DESCRIPTOR` |
309 | 322 | * `DOCKER_METADATA_OUTPUT_JSON` |
310 | 323 | * `DOCKER_METADATA_OUTPUT_BAKE_FILE_TAGS` |
311 | 324 | * `DOCKER_METADATA_OUTPUT_BAKE_FILE_LABELS` |
| 325 | +* `DOCKER_METADATA_OUTPUT_BAKE_FILE_ANNOTATIONS_INDEX` |
| 326 | +* `DOCKER_METADATA_OUTPUT_BAKE_FILE_ANNOTATIONS_INDEX_DESCRIPTOR` |
| 327 | +* `DOCKER_METADATA_OUTPUT_BAKE_FILE_ANNOTATIONS_MANIFEST_INDEX` |
| 328 | +* `DOCKER_METADATA_OUTPUT_BAKE_FILE_ANNOTATIONS_MANIFEST_DESCRIPTOR` |
312 | 329 |
|
313 | 330 | So it can be used with our [Docker Build Push action](https://github.com/docker/build-push-action/): |
314 | 331 |
|
@@ -889,6 +906,46 @@ labels generated are not suitable, you can overwrite them like this: |
889 | 906 | org.opencontainers.image.vendor=MyCompany |
890 | 907 | ``` |
891 | 908 |
|
| 909 | +### Annotations |
| 910 | + |
| 911 | +Since Buildx 0.12, it is possible to set annotations to your image through the |
| 912 | +`--annotation` flag. With the [`build-push-action`](https://github.com/docker/build-push-action/), |
| 913 | +you can set the `annotations` input with one of the `annotations-*` outputs |
| 914 | +of the `metadata-action`: |
| 915 | + |
| 916 | +```yaml |
| 917 | + - |
| 918 | + name: Docker meta |
| 919 | + uses: docker/metadata-action@v5 |
| 920 | + with: |
| 921 | + images: name/app |
| 922 | + - |
| 923 | + name: Build and push |
| 924 | + uses: docker/build-push-action@v5 |
| 925 | + with: |
| 926 | + tags: ${{ steps.meta.outputs.tags }} |
| 927 | + annotations: ${{ steps.meta.outputs.annotations-index }} |
| 928 | +``` |
| 929 | + |
| 930 | +The same can be done with the [`bake-action`](https://github.com/docker/bake-action/): |
| 931 | + |
| 932 | +```yaml |
| 933 | + - |
| 934 | + name: Docker meta |
| 935 | + uses: docker/metadata-action@v5 |
| 936 | + with: |
| 937 | + images: name/app |
| 938 | + - |
| 939 | + name: Build |
| 940 | + uses: docker/bake-action@v3 |
| 941 | + with: |
| 942 | + files: | |
| 943 | + ./docker-bake.hcl |
| 944 | + ${{ steps.meta.outputs.bake-file-tags }} |
| 945 | + ${{ steps.meta.outputs.bake-file-annotations-index }} |
| 946 | + targets: build |
| 947 | +``` |
| 948 | + |
892 | 949 | ## Contributing |
893 | 950 |
|
894 | 951 | Want to contribute? Awesome! You can find information about contributing to |
|
0 commit comments