Skip to content

Commit

Permalink
Set platform tag
Browse files Browse the repository at this point in the history
  • Loading branch information
ukanga committed May 13, 2024
1 parent d33a7da commit 8e68a45
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion .github/workflows/ecr-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,25 @@ jobs:
optional_packages=PyYAML django-redis ${{ secrets.ECR_OPTIONAL_PACKAGES }}
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/onaio/onadata:${{ env.version || github.ref_name }}
"${{ steps.login-ecr.outputs.registry }}/onaio/onadata:${{ env.version || github.ref_name }}"
labels: |
"${{ matrix.platform }}"
provenance: false
outputs: type=image,name=${{ steps.login-ecr.outputs.registry }}/onaio/onadata,push-by-digest=true,name-canonical=true,push=true
-
name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
-
name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

- name: (Alpine) Build and push
id: docker-build-alpine
Expand Down Expand Up @@ -164,3 +182,41 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
merge:
runs-on: ubuntu-latest
needs:
- build
steps:
-
name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: "${{ steps.login-ecr.outputs.registry }}/onaio/onadata:${{ env.version || github.ref_name }}"
-
name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ steps.login-ecr.outputs.registry }}/onaio/onadata@sha256:%s ' *)
-
name: Inspect image
run: |
docker buildx imagetools inspect "${{ steps.login-ecr.outputs.registry }}/onaio/onadata":${{ steps.meta.outputs.version }}

0 comments on commit 8e68a45

Please sign in to comment.