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 ac6ffd3
Showing 1 changed file with 60 additions and 4 deletions.
64 changes: 60 additions & 4 deletions .github/workflows/ecr-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
paltform:
platform:
- linux/arm64
steps:
- name: Prepare
Expand Down Expand Up @@ -75,15 +75,33 @@ jobs:
context: .
file: ./docker/onadata-uwsgi/Dockerfile.ubuntu
platforms: ${{ matrix.platform }}
cache-from: type=registry,ref=${{ steps.login-ecr.outputs.registry }}/onaio/onadata:${{ env.version }}
cache-from: type=registry,ref=${{ steps.login-ecr.outputs.registry }}/onaio/onadata:${{ env.version }}-${{ env.PLATFORM_PAIR }}
cache-to: type=inline
ssh: |
default=/tmp/ssh-agent.sock
build-args: |
optional_packages=PyYAML django-redis ${{ secrets.ECR_OPTIONAL_PACKAGES }}
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/onaio/onadata:${{ env.version || github.ref_name }}
# tags: |
# "${{ 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:${{ env.version || github.ref_name }}-${{ env.PLATFORM_PAIR }},push-by-digest=false,name-canonical=true,push=true
-
name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.docker-build-ubuntu.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 ac6ffd3

Please sign in to comment.