Builds a Docker image and pushes it to the private registry of your choosing.
Forked and modified to fit Extenda GitHub Actions. Credit goes to Sean Smith.
- Ensure you run the checkout action before using this action
- Add the following to a workflow
.ymlfile in the/.githubdirectory of your repo
steps:
- uses: actions/checkout@v1.0
- uses: extenda/actions/docker@v0
with:
image: repo/image
tag: latest
registry: registry-url.io
dockerfile: Dockerfile.ci
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}| Name | Description | Required |
|---|---|---|
| image | Docker image name (e.g. extenda/repo-name) | Yes |
| tag | Docker image tag(s), supports a list of tags. (Information should be available in conventional-version step) | Yes |
| registry | Docker registry host (complete URL or just leave empty to get Extenda AWS ECR) | No |
| dockerfile | Location of Dockerfile (defaults to Dockerfile) |
No |
| docker-context | Docker context, is either URL or working directory. Defaults to . |
No |
| push | Toggle whether to push image or not. Defaults to true | No |
| buildArgs | Docker build arguments in format KEY=VALUE,KEY=VALUE |
No |
| username | Docker registry username | No |
| password | Docker registry password or token | No |
- Get access keys from Platform team. You can request repos here for instance here: 'tf-infra'
- Save
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYas secrets in your GitHub repo - Modify sample below and include in your workflow
.github/workflows/*.ymlfile
uses: extenda/actions/docker@v0
with:
image: extenda/repo-name
tag: latest,1.0.0
dockerfile: project-folder/Dockerfile
docker-context: project-folder
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}- Save your Docker Hub username (
DOCKER_USERNAME) and password (DOCKER_PASSWORD) as secrets in your GitHub repo - Modify sample below and include in your workflow
.github/workflows/*.ymlfile
uses: extenda/actions/docker@v0
with:
image: docker-hub-repo/image-name
tag: latest
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}- Create a service account with the ability to push to GCR (see configuring access control)
- Create and download JSON key for new service account
- Save content of
.jsonfile as a secret calledDOCKER_PASSWORDin your GitHub repo - Modify sample below and include in your workflow
.github/workflows/*.ymlfile - Ensure you set the username to
_json_key
uses: extenda/actions/docker@v0
with:
image: gcp-project/image-name
tag: latest
registry: gcr.io
username: _json_key
password: ${{ secrets.DOCKER_PASSWORD }}- Create an IAM user with the ability to push to ECR (see example policies)
- Create and download access keys
- Save
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYas secrets in your GitHub repo - Modify sample below and include in your workflow
.github/workflows/*.ymlfile
uses: extenda/actions/docker@v0
with:
image: image-name
tag: latest
registry: [aws-account-number].dkr.ecr.[region].amazonaws.com
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}