-
Notifications
You must be signed in to change notification settings - Fork 44
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
Lukasz Maslanka
committed
Aug 8, 2024
1 parent
f9c6adf
commit e000820
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
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,78 @@ | ||
name: shuttle-docker-build | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' | ||
|
||
env: | ||
AWS_REGION: "us-east-1" | ||
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY }}" | ||
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_KEY }}" | ||
AWS_DEFAULT_OUTPUT: "json" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
# https://docs.docker.com/build/ci/github-actions/multi-platform/ | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
# Workaround: https://github.com/docker/build-push-action/issues/461 | ||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Convert previous steps output to env var | ||
run: | | ||
echo "ECR_REGISTRY=${{ steps.login-ecr.outputs.registry }}" >> ${GITHUB_ENV} | ||
- name: Log in to the github container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
images: | | ||
ghcr.io/${{ github.repository }} | ||
${{ env.ECR_REGISTRY }}/shuttle | ||
tags: | | ||
type=sha | ||
type=semver,pattern={{version}} | ||
- name: Build docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: ${{ github.event_name != 'pull_request' }} | ||
file: eth/Dockerfile | ||
context: eth | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }} | ||
labels: ${{ env.DOCKER_METADATA_OUTPUT_LABELS }} |