Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for amd64 and arm64 image builds #2

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions .github/workflows/docker-image-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@ on:
description: "Branch Name"
required: true
default: ''
tagDockerTargetName:
description: "Docker Target"
required: true
default: 'default'
branchDockerTargetName:
description: "Docker Target"
required: true
default: 'default'

jobs:
main:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -64,38 +57,39 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build and push a tag
id: docker-build-tag
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push a tag for linux amd64 and arm64 platforms
id: docker-build-tag-for-linux-amd64-and-arm64-platforms
uses: docker/build-push-action@v2
if: ${{ github.event.inputs.versionTag == '' && github.event_name == 'release' }}
with:
context: .
target: ${{ github.event.inputs.tagDockerTargetName }}
file: Dockerfile
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/onaio/akuko-temporal-go-tooling:${{ github.event.inputs.versionTag || steps.get-tag-version.outputs.TAG_VERSION }}

- name: Build and push a branch
id: docker-build-branch
- name: Build and push a branch for linux amd64 and arm64 platforms
id: docker-build-branch-for-linux-amd64-and-arm64-platforms
uses: docker/build-push-action@v2
if: |
${{ github.event.inputs.branchName == '' && github.event_name == 'pull_request' }} || ${{ github.event.inputs.branchName == '' && github.event_name == 'push' }}
with:
context: .
target: ${{ github.event.inputs.branchDockerTargetName }}
file: Dockerfile
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/onaio/akuko-temporal-go-tooling:${{ github.event.inputs.branchName || steps.get-branch-name.outputs.current_branch }}

- name: Image digest tag
- name: Image digest tag for linux amd64 and arm64 platforms
if: ${{ github.event.inputs.versionTag == '' && github.event_name == 'release' }}
run: echo ${{ steps.docker-build-tag.outputs.digest }}
run: echo ${{ steps.docker-build-tag-for-linux-amd64-and-arm64-platforms.outputs.digest }}

- name: Image digest branch
- name: Image digest branch for linux amd64 and arm64 platforms
if: |
${{ github.event.inputs.branchName == '' && github.event_name == 'pull_request' }} || ${{ github.event.inputs.branchName == '' && github.event_name == 'push' }}
run: echo ${{ steps.docker-build-branch.outputs.digest }}
run: echo ${{ steps.docker-build-branch-for-linux-amd64-and-arm64-platforms.outputs.digest }}
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,20 @@ Before running the tool, make sure to set the following environment variables:

### Docker

Alternatively, you can use Docker to run the module. The Dockerfile is provided in the repository.
Building for arm64 based architectures:
```
docker buildx build -t <docker_tag_name> --platform linux/arm64 .
```

Building for amd64 based architectures:
```
docker buildx build -t <docker_tag_name> --platform linux/amd64 .
```

Building for both amd64 and arm64 based architectures:
```
docker buildx build -t <docker_tag_name> --platform linux/amd64, linux/arm64 .
```

## Contributing

Expand Down
Loading