-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7763f25
commit 09990df
Showing
4 changed files
with
116 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,47 @@ | ||
# docker-qemu-buildx-ecr-action | ||
|
||
Docker QEMU Buildx ECR Action - supports multi platform builds including linux/arm64 and ECR Push | ||
|
||
## Usage | ||
|
||
```yaml | ||
name: ci | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
qemu: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Docker QEMU Buildx ECR | ||
uses: bbharathkumarreddy/docker-qemu-buildx-ecr-action | ||
with: | ||
platform: linux/arm64 | ||
ecr-push: true | ||
aws-access-key-id: ${{ secrets.aws-access-key-id }} | ||
aws-secret-access-key: ${{ secrets.aws-secret-access-key }} | ||
aws-region: ${{ vars.aws-region }} | ||
ecr-repository: my-service | ||
ecr-tag: latest | ||
``` | ||
## Customizing | ||
### inputs | ||
The following inputs can be used as `step.with` keys: | ||
|
||
| Name | Type | Default | Description | | ||
| ----------------------- | ------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | | ||
| `platform` | String | [`linux/arm64`](https://docs.docker.com/build/building/multi-platform/) | Platform architecture to build. | | ||
| `ecr-push` | Boolean | `true` | Set to `true` to push the docker build to ECR repository. `aws.*` and `ecr.*` inputs to be given if set to `true`. | | ||
| `aws-access-key-id` | String | | Pass the AWS access key id. | | ||
| `aws-secret-access-key` | String | | Pass the AWS secret access key. | | ||
| `aws-region` | String | | Pass the AWS region of the ECR repository. | | ||
| `ecr-repository` | String | | Pass the ECR repository name. | | ||
| `ecr-tag` | String | `latest` | Pass ECR tag to push. | | ||
|
||
## Contributing | ||
|
||
Want to contribute? ✅ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: "Docker QEMU Buildx ECR Action" | ||
description: "Docker QEMU Buildx ECR Action - supports multi platform builds including linux/arm64 and ECR Push" | ||
author: "bbharathkumarreddy@96@gmail.com" | ||
branding: | ||
icon: "package" | ||
color: "blue" | ||
|
||
inputs: | ||
platform: | ||
description: "Platform architecture to build." | ||
default: "linux/arm64" | ||
required: false | ||
ecr-push: | ||
description: "ECR push." | ||
default: "true" | ||
required: false | ||
aws-access-key-id: | ||
description: "AWS access key id." | ||
required: false | ||
aws-secret-access-key: | ||
description: "AWS Secret access key." | ||
required: false | ||
aws-region: | ||
description: "AWS region of the ECR repository." | ||
required: false | ||
ecr-repository: | ||
description: "ECR repository name." | ||
required: false | ||
ecr-tag: | ||
description: "AWS region." | ||
default: "latest" | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Configure AWS credentials | ||
if: ${{ inputs.ecr-push == 'true' }} | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ inputs.aws-access-key-id }} | ||
aws-secret-access-key: ${{ inputs.aws-secret-access-key }} | ||
aws-region: ${{ inputs.aws-region }} | ||
|
||
- name: Login to Amazon ECR | ||
if: ${{ inputs.ecr-push == 'true' }} | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: ECR Build and push | ||
uses: docker/build-push-action@v5 | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: ${{ inputs.ecr-repository }} | ||
IMAGE_TAG: ${{ inputs.ecr-tag }} | ||
AWS_REGION: ${{ inputs.aws-region }} | ||
with: | ||
push: ${{ inputs.ecr-push }} | ||
context: . | ||
platforms: ${{ inputs.platform }} | ||
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} | ||
provenance: false | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |