Public Access
1
0
mirror of https://github.com/docker/build-push-action.git synced 2026-04-23 04:48:53 +03:00

Compare commits

...

15 Commits

Author SHA1 Message Date
CrazyMax 3e7a4f6646 Merge pull request #197 from crazy-max/releases/v1
Update deprecation message for v1
2020-10-23 13:29:08 +02:00
CrazyMax 79bd2e083d Update deprecation message for v1
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2020-10-22 20:32:36 +02:00
Tõnis Tiigi ab83648e2e Merge pull request #106 from docker/deprecation-notice
Add deprecation notice (v2 available)
2020-09-08 14:11:29 -07:00
CrazyMax 35323d9aa4 Add deprecation notice (v2 available)
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2020-09-08 23:08:57 +02:00
Tõnis Tiigi 836357fa9e Merge pull request #54 from mikemol/patch-1
Demonstrate simple ref tag
2020-07-16 09:08:40 -07:00
Tõnis Tiigi 8e21df3514 Merge pull request #75 from rcorrear/patch-1
Update README.md
2020-07-16 09:03:21 -07:00
Ricardo Correa 5aca64f130 Update README.md
Add checkout step to examples.

Signed-off-by: Ricardo Correa <r.correa.r@gmail.com>
2020-07-16 12:09:10 +02:00
Chris Crone 7cb863f593 Merge pull request #45 from gkkachi/fix-typo-gcr
Fix typo
2020-06-15 15:23:21 +02:00
Michael Mol 6115ff08ad Demonstrate simple ref tag
Existing ref tag examples highlighted special cases, but none demonstrated the simplest branch case.

Signed-off-by: Michael Mol <mikemol@gmail.com>
2020-06-06 20:02:18 +00:00
Konosuke Kachi 68257a7f8a Fix typo
Signed-off-by: Konosuke Kachi <github@s.k-kachi.net>
2020-05-16 15:25:56 +09:00
Nick Adcock 92e7146349 Merge pull request #35 from docker/add-cache-from
Add cache_froms input to support --cache-from
2020-04-23 18:41:09 +01:00
Nick Adcock 3ff814758e Merge pull request #31 from andrew-waters/example-gcr
Adds GCR example
2020-04-23 13:14:11 +01:00
Andrew Waters 4ca0e628b9 Add: explicit tag
Signed-off-by: Andrew Waters <waters@me.com>
2020-04-23 13:10:55 +01:00
Nick Adcock abc498d7d3 Add cache_froms input to support --cache-from
Signed-off-by: Nick Adcock <nick.adcock@docker.com>
2020-04-22 16:34:18 +01:00
Andrew Waters 13d7e7a55b Adds GCR example
Signed-off-by: Andrew Waters <waters@me.com>
2020-04-16 14:07:17 +01:00
2 changed files with 80 additions and 28 deletions
+76 -28
View File
@@ -17,6 +17,7 @@ Suggestions and issues can be posted on the repositories [issues page](https://g
* [target](#target)
* [always_pull](#always_pull)
* [build_args](#build_args)
* [cache_froms](#cache_froms)
* [labels](#labels)
* [add_git_labels](#add_git_labels)
* [push](#push)
@@ -68,6 +69,7 @@ Examples:
|Git Reference|Image tag|
|---|---|
|`refs/heads/master`|`latest`|
|`refs/heads/mybranch`|`mybranch`|
|`refs/heads/my/branch`|`my-branch`|
|`refs/pull/2/merge`|`pr-2-merge`|
|`refs/tags/v1.0.0`|`v1.0.0`|
@@ -114,6 +116,15 @@ Example:
build_args: arg1=value1,arg2=value2
```
### `cache_froms`
Comma-delimited list of images to consider as cache sources.
Example:
```yaml
cache_froms: myorg/baseimage:latest
```
### `labels`
Comma-delimited list of labels to add to the built image.
@@ -150,46 +161,83 @@ Whether to push the built image.
The following will build the root Dockerfile, tag the image as `myorg/myrepository:latest`, log in to Docker Hub using GitHub secrets, and push the image to the Docker Hub repository `myorg/myrepository`:
```yaml
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tags: latest
steps:
- name: Checkout code
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
tags: latest
```
The following will build the root Dockerfile, tag the image with the git reference and SHA as described above, log in to Docker Hub using GitHub secrets, and push the image to the Docker Hub repository `myorg/myrepository`:
```yaml
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tag_with_ref: true
tag_with_sha: true
steps:
- name: Checkout code
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
tag_with_ref: true
tag_with_sha: true
```
The following will only push the image when the event that kicked off the workflow was a push of a git tag:
```yaml
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tag_with_ref: true
push: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Checkout code
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
tag_with_ref: true
push: ${{ startsWith(github.ref, 'refs/tags/') }}
```
The following builds the `mytarget` stage and pushes that:
```yaml
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tag_with_ref: true
target: mytarget
```
steps:
- name: Checkout code
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
tag_with_ref: true
target: mytarget
```
The following will build the root Dockerfile, tag the image as `myorg/myrepository:latest`, log in to Google Container Registry using GitHub secrets (where `DOCKER_PASSWORD` is a [JSON key](https://cloud.google.com/container-registry/docs/advanced-authentication#json-key)), and push the image to the GCR repository `myorg/myrepository`:
```yaml
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: _json_key
password: ${{ secrets.DOCKER_PASSWORD }}
registry: gcr.io
repository: myorg/myrepository
tags: latest
```
+4
View File
@@ -20,6 +20,7 @@ inputs:
description: Server address of Docker registry. If not set then will default to Docker Hub
required: false
repository:
deprecationMessage: 'v2 is now available through docker/build-push-action@v2'
description: Docker repository to tag the image with
required: true
tags:
@@ -50,6 +51,9 @@ inputs:
build_args:
description: Comma-delimited list of build-time variables
required: false
cache_froms:
description: Comma-delimited list of images to consider as cache sources
required: false
labels:
description: Comma-delimited list of labels to add to the built image
required: false