mirror of
https://github.com/docker/login-action.git
synced 2025-04-19 01:26:45 +00:00
Add support for AWS Elastic Container Registry (ECR)
Add example for Google Container Registry (GCR)
This commit is contained in:
parent
e6dc03b339
commit
f37c715508
5 changed files with 169 additions and 23 deletions
66
README.md
66
README.md
|
@ -18,6 +18,8 @@ ___
|
|||
* [DockerHub](#dockerhub)
|
||||
* [GitHub Package Registry](#github-package-registry)
|
||||
* [GitLab](#gitlab)
|
||||
* [Google Container Registry (GCR)](#gitlab)
|
||||
* [AWS Elastic Container Registry (ECR)](#gitlab)
|
||||
* [Customizing](#customizing)
|
||||
* [inputs](#inputs)
|
||||
* [Limitation](#limitation)
|
||||
|
@ -34,7 +36,6 @@ name: ci
|
|||
on:
|
||||
push:
|
||||
branches: master
|
||||
tags:
|
||||
|
||||
jobs:
|
||||
login:
|
||||
|
@ -59,7 +60,6 @@ name: ci
|
|||
on:
|
||||
push:
|
||||
branches: master
|
||||
tags:
|
||||
|
||||
jobs:
|
||||
login:
|
||||
|
@ -85,7 +85,6 @@ name: ci
|
|||
on:
|
||||
push:
|
||||
branches: master
|
||||
tags:
|
||||
|
||||
jobs:
|
||||
login:
|
||||
|
@ -103,6 +102,67 @@ jobs:
|
|||
password: ${{ secrets.GITLAB_PASSWORD }}
|
||||
```
|
||||
|
||||
### Google Container Registry (GCR)
|
||||
|
||||
Use a service account with the ability to push to GCR and [configure access control](https://cloud.google.com/container-registry/docs/access-control).
|
||||
Then create and download the JSON key for this service account and save content of `.json` file
|
||||
[as a secret](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository)
|
||||
called `GCR_JSON_KEY` in your GitHub repo. Ensure you set the username to `_json_key`.
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to GCR
|
||||
uses: crazy-max/ghaction-docker-login@v1
|
||||
with:
|
||||
registry: gcr.io
|
||||
username: _json_key
|
||||
password: ${{ secrets.GCR_JSON_KEY }}
|
||||
```
|
||||
|
||||
### AWS Elastic Container Registry (ECR)
|
||||
|
||||
Use an IAM user with the [ability to push to ECR](https://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr_managed_policies.html).
|
||||
Then create and download access keys and save `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` [as secrets](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets-for-a-repository)
|
||||
in your GitHub repo.
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to ECR
|
||||
uses: crazy-max/ghaction-docker-login@v1
|
||||
with:
|
||||
registry: <aws-account-number>.dkr.ecr.<region>.amazonaws.com
|
||||
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
```
|
||||
|
||||
> Replace `<aws-account-number>` and `<region>` with their respective values.
|
||||
|
||||
## Customizing
|
||||
|
||||
### inputs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue