mirror of
https://github.com/docker/build-push-action.git
synced 2025-05-08 22:49:29 +02:00
docs: examples moved to docs website
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
6e95f19fb8
commit
d4c14fd006
14 changed files with 18 additions and 932 deletions
|
@ -1,60 +1,3 @@
|
|||
# Share built image between jobs
|
||||
|
||||
As each job is isolated in its own runner you cannot use your built image
|
||||
between jobs (except for [self-hosted runners](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners)).
|
||||
However, you can [pass data between jobs in a workflow](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts#passing-data-between-jobs-in-a-workflow)
|
||||
using the [actions/upload-artifact](https://github.com/actions/upload-artifact)
|
||||
and [actions/download-artifact](https://github.com/actions/download-artifact)
|
||||
actions:
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
-
|
||||
name: Build and export
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
tags: myimage:latest
|
||||
outputs: type=docker,dest=/tmp/myimage.tar
|
||||
-
|
||||
name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: myimage
|
||||
path: /tmp/myimage.tar
|
||||
|
||||
use:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
-
|
||||
name: Download artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: myimage
|
||||
path: /tmp
|
||||
-
|
||||
name: Load image
|
||||
run: |
|
||||
docker load --input /tmp/myimage.tar
|
||||
docker image ls -a
|
||||
```
|
||||
This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/examples/#share-built-image-between-jobs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue