1
0
Fork 0
mirror of https://github.com/docker/build-push-action.git synced 2025-04-01 20:50:09 +02:00

Add example to upload image as an artifact

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-10-13 21:22:33 +02:00
parent 3149cc2fd7
commit 75d73cbd4e
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7

View file

@ -36,6 +36,7 @@ ___
* [Advanced usage](#advanced-usage)
* [Push to multi-registries](#push-to-multi-registries)
* [Cache to registry](#push-to-multi-registries)
* [Upload image as an artifact](#upload-image-as-an-artifact)
* [Local registry](#local-registry)
* [Leverage GitHub cache](#leverage-github-cache)
* [Complete workflow](#complete-workflow)
@ -333,6 +334,52 @@ You can import/export cache from a cache manifest or (special) image configurati
```
</details>
### Upload image as an artifact
You can export the result image or manifest list as an [OCI image layout](https://github.com/opencontainers/image-spec/blob/master/image-layout.md)
tarball through [actions/upload-artifact](https://github.com/actions/upload-artifact/) action:
<details>
<summary><b>Show workflow</b></summary>
```yaml
name: ci
on:
push:
branches: master
jobs:
upload-artifact:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build and export
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
tags: name/app:latest
outputs: type=oci,dest=/tmp/image.tar
-
name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: app
path: /tmp/image.tar
```
</details>
### Local registry
For testing purposes you may need to create a [local registry](https://hub.docker.com/_/registry) to push images into: