You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -8,19 +9,20 @@ Builds a Docker image and pushes it to the private registry of your choosing.
8
9
9
10
## Supported Docker registries
10
11
11
-
* Docker Hub
12
-
* Google Container Registry (GCR)
13
-
* AWS Elastic Container Registry (ECR)
14
-
* GitHub Docker Registry
12
+
- Docker Hub
13
+
- Google Container Registry (GCR)
14
+
- AWS Elastic Container Registry (ECR)
15
+
- GitHub Docker Registry
15
16
16
17
## Breaking changes
17
18
18
19
If you're experiencing issues, be sure you are using the [latest stable release](https://github.com/mr-smithers-excellent/docker-build-push/releases/latest) (currently v5). The AWS ECR login command became deprecated between v4 and v5. Additionally, support for multiple tags was added between v4 and v5.
19
20
20
21
## Basic usage
21
22
22
-
* Ensure you run the [checkout action](https://github.com/actions/checkout) before using this action
23
-
* Add the following to a workflow `.yml` file in the `/.github` directory of your repo
23
+
- Ensure you run the [checkout action](https://github.com/actions/checkout) before using this action
24
+
- Add the following to a workflow `.yml` file in the `/.github` directory of your repo
| imageFullName | Full name of the Docker image with registry prefix | `registry/owner/image` |
65
+
| imageName | Name of the Docker image with owner prefix | `owner/image` |
66
+
| tags | Tags for the Docker image | `v1,latest` |
64
67
65
68
## Examples
66
69
67
70
### Docker Hub
68
71
69
-
* Save your Docker Hub username (`DOCKER_USERNAME`) and password (`DOCKER_PASSWORD`) as secrets in your GitHub repo
70
-
* Modify sample below and include in your workflow `.github/workflows/*.yml` file
72
+
-Save your Docker Hub username (`DOCKER_USERNAME`) and password (`DOCKER_PASSWORD`) as secrets in your GitHub repo
73
+
-Modify sample below and include in your workflow `.github/workflows/*.yml` file
71
74
72
75
```yaml
73
76
uses: mr-smithers-excellent/docker-build-push@v5
@@ -80,28 +83,28 @@ with:
80
83
81
84
### Google Container Registry (GCR)
82
85
83
-
* Create a service account with the ability to push to GCR (see [configuring access control](https://cloud.google.com/container-registry/docs/access-control))
84
-
* Create and download JSON key for new service account
85
-
* Save content of `.json` file as a secret called `DOCKER_PASSWORD` in your GitHub repo
86
-
* Modify sample below and include in your workflow `.github/workflows/*.yml` file
87
-
* Ensure you set the username to `_json_key`
86
+
-Create a service account with the ability to push to GCR (see [configuring access control](https://cloud.google.com/container-registry/docs/access-control))
87
+
-Create and download JSON key for new service account
88
+
-Save content of `.json` file as a secret called `DOCKER_PASSWORD` in your GitHub repo
89
+
-Modify sample below and include in your workflow `.github/workflows/*.yml` file
90
+
-Ensure you set the username to `_json_key`
88
91
89
92
```yaml
90
93
uses: mr-smithers-excellent/docker-build-push@v5
91
94
with:
92
95
image: gcp-project/image-name
93
96
registry: gcr.io
94
-
username: _json_key
95
-
password: ${{ secrets.DOCKER_PASSWORD }}
97
+
username: _json_key
98
+
password: ${{ secrets.DOCKER_PASSWORD }}
96
99
```
97
100
98
101
### AWS Elastic Container Registry (ECR)
99
102
100
-
* Create an IAM user with the ability to push to ECR (see [example policies](https://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr_managed_policies.html))
101
-
* Create and download access keys
102
-
* Save `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` as secrets in your GitHub repo
103
-
* Ensure the repo you are trying to push to already exists, if not create with `aws ecr create-repository` before pushing
104
-
* Modify sample below and include in your workflow `.github/workflows/*.yml` file
103
+
-Create an IAM user with the ability to push to ECR (see [example policies](https://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr_managed_policies.html))
104
+
-Create and download access keys
105
+
-Save `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` as secrets in your GitHub repo
106
+
-Ensure the repo you are trying to push to already exists, if not create with `aws ecr create-repository` before pushing
107
+
-Modify sample below and include in your workflow `.github/workflows/*.yml` file
105
108
106
109
```yaml
107
110
uses: mr-smithers-excellent/docker-build-push@v5
@@ -115,12 +118,12 @@ env:
115
118
116
119
### GitHub Container Registry
117
120
118
-
* GitHub recently [migrated their container registry](https://docs.github.com/en/packages/guides/migrating-to-github-container-registry-for-docker-images) from docker.pkg.github.com to ghcr.io
119
-
* It is assumed you'll be pushing the image to a repo inside your GitHub organization, unless you set `githubOrg`
120
-
* If using ghcr.io, provide the image name in `ghcr.io/OWNER/IMAGE_NAME` format
121
-
* If using docker.pkg.github.com, provide the image name in `docker.pkg.github.com/OWNER/REPOSITORY/IMAGE_NAME` format
122
-
* Provide either the `${{ github.actor }}` or an alternate username for Docker login (with associated token below)
123
-
* Pass the default GitHub Actions token or custom secret with [proper push permissions](https://docs.github.com/en/packages/guides/pushing-and-pulling-docker-images#authenticating-to-github-container-registry)
121
+
-GitHub recently [migrated their container registry](https://docs.github.com/en/packages/guides/migrating-to-github-container-registry-for-docker-images) from docker.pkg.github.com to ghcr.io
122
+
-It is assumed you'll be pushing the image to a repo inside your GitHub organization, unless you set `githubOrg`
123
+
-If using ghcr.io, provide the image name in `ghcr.io/OWNER/IMAGE_NAME` format
124
+
-If using docker.pkg.github.com, provide the image name in `docker.pkg.github.com/OWNER/REPOSITORY/IMAGE_NAME` format
125
+
-Provide either the `${{ github.actor }}` or an alternate username for Docker login (with associated token below)
126
+
-Pass the default GitHub Actions token or custom secret with [proper push permissions](https://docs.github.com/en/packages/guides/pushing-and-pulling-docker-images#authenticating-to-github-container-registry)
124
127
125
128
#### New ghcr.io
126
129
@@ -131,7 +134,7 @@ with:
131
134
registry: ghcr.io
132
135
githubOrg: override-org # optional
133
136
username: ${{ secrets.GHCR_USERNAME }}
134
-
password: ${{ secrets.GHCR_TOKEN }}
137
+
password: ${{ secrets.GHCR_TOKEN }}
135
138
```
136
139
137
140
#### Legacy docker.pkg.github.com
@@ -149,13 +152,13 @@ with:
149
152
150
153
By default, if you do not pass a `tags` input this action will use an algorithm based on the state of your git repo to determine the Docker image tag(s). This is designed to enable developers to more easily use [GitOps](https://www.weave.works/technologies/gitops/) in their CI/CD pipelines. Below is a table detailing how the GitHub trigger (branch or tag) determines the Docker tag(s).
0 commit comments