2020-09-29 01:08:58 +02:00
|
|
|
# Upgrade notes
|
|
|
|
|
|
|
|
## v1 to v2
|
|
|
|
|
2020-09-29 02:40:47 +02:00
|
|
|
* Input `path` is now called `context` for consistency with other Docker build tools
|
|
|
|
* `path` defaults to current git repository so checkout action is not required in a workflow
|
|
|
|
* Rename `dockerfile` input to `file` for consistency with other Docker build tools
|
|
|
|
* Rename `always_pull` input to `pull` for consistency with other Docker build tools
|
2020-09-29 01:08:58 +02:00
|
|
|
* Add `builder` input to be able to choose a builder instance through our [setup-buildx action](https://github.com/docker/setup-buildx-action)
|
2021-04-03 20:41:31 +02:00
|
|
|
* Add `platforms` input to support multi-platform builds
|
|
|
|
* Add `allow` input
|
|
|
|
* Add `load` input
|
|
|
|
* Add `outputs` input
|
|
|
|
* Add `cache-from` input (`cache_froms` removed)
|
|
|
|
* Add `cache-to` input
|
2020-11-03 16:48:29 +00:00
|
|
|
* Rename `build_args` input to `build-args` for consistency with other Docker build tools
|
2020-09-29 01:08:58 +02:00
|
|
|
* Add `secrets` input
|
|
|
|
* Review `tags` input
|
|
|
|
* Remove `repository` input. See [Simple workflow](#simple-workflow) for migration
|
|
|
|
* Remove `username`, `password` and `registry` inputs. Login support moved to [docker/login-action](https://github.com/docker/login-action) repo
|
|
|
|
* Remove `tag_with_sha`, `tag_with_ref`, `add_git_labels` inputs. See [Tags with ref and Git labels](#tags-with-ref-and-git-labels) for migration
|
|
|
|
* Handle Git context
|
|
|
|
* Add `digest` output
|
|
|
|
|
|
|
|
### Simple workflow
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
# v1
|
|
|
|
steps:
|
|
|
|
-
|
2021-11-16 05:01:51 +01:00
|
|
|
name: Checkout
|
2020-09-29 01:08:58 +02:00
|
|
|
uses: actions/checkout@v2
|
|
|
|
-
|
|
|
|
name: Build and push Docker images
|
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: myorg/myrepository
|
|
|
|
always_pull: true
|
|
|
|
build_args: arg1=value1,arg2=value2
|
|
|
|
cache_froms: myorg/myrepository:latest
|
|
|
|
tags: latest
|
|
|
|
```
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
# v2
|
|
|
|
steps:
|
|
|
|
-
|
2021-11-16 05:01:51 +01:00
|
|
|
name: Checkout
|
2020-09-29 01:08:58 +02:00
|
|
|
uses: actions/checkout@v2
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
-
|
|
|
|
name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
pull: true
|
|
|
|
push: true
|
2020-10-21 17:34:06 +02:00
|
|
|
build-args: |
|
|
|
|
arg1=value1
|
|
|
|
arg2=value2
|
2020-10-04 01:10:42 +02:00
|
|
|
cache-from: type=registry,ref=myorg/myrepository:latest
|
|
|
|
cache-to: type=inline
|
2020-09-29 01:08:58 +02:00
|
|
|
tags: myorg/myrepository:latest
|
|
|
|
```
|
|
|
|
|
|
|
|
### Tags with ref and Git labels
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
# v1
|
|
|
|
steps:
|
|
|
|
-
|
2021-11-16 05:01:51 +01:00
|
|
|
name: Checkout
|
2020-09-29 01:08:58 +02:00
|
|
|
uses: actions/checkout@v2
|
|
|
|
-
|
|
|
|
name: Build and push Docker images
|
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: myorg/myrepository
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tag_with_ref: true
|
|
|
|
tag_with_sha: true
|
2020-10-28 19:40:11 +01:00
|
|
|
add_git_labels: true
|
2020-09-29 01:08:58 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
# v2
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
-
|
2021-07-29 09:49:25 +02:00
|
|
|
name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
myorg/myrepository
|
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=sha
|
2020-09-29 01:08:58 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
-
|
|
|
|
name: Login to DockerHub
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2021-07-29 09:49:25 +02:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2020-09-29 01:08:58 +02:00
|
|
|
```
|