Update multiple files (#134) #60
This file contains hidden or 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
| name: ECR Release Workflow | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build-riva-arm64: | |
| runs-on: ubuntu-22.04-arm | |
| permissions: | |
| id-token: write | |
| contents: read | |
| outputs: | |
| image-digest: ${{ steps.build.outputs.digest }} | |
| metadata: ${{ steps.meta.outputs.json }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v3 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to Amazon ECR Public | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| registry-type: public | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: public.ecr.aws/b8k9c8n5/openmind/riva-speech-server | |
| tags: | | |
| type=semver,pattern={{version}},prefix=v | |
| type=semver,pattern={{major}}.{{minor}},prefix=v | |
| type=ref,event=branch | |
| type=sha | |
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
| type=raw,value=2.24.0-l4t-aarch64 | |
| - name: Build and push ARM64 image by digest | |
| id: build | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile.riva | |
| platforms: linux/arm64 | |
| labels: ${{ steps.meta.outputs.labels }} | |
| outputs: type=image,name=public.ecr.aws/b8k9c8n5/openmind/riva-speech-server,push-by-digest=true,name-canonical=true,push=true | |
| build-embedding-arm64: | |
| runs-on: ubuntu-22.04-arm | |
| permissions: | |
| id-token: write | |
| contents: read | |
| outputs: | |
| image-digest: ${{ steps.build.outputs.digest }} | |
| metadata: ${{ steps.meta.outputs.json }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v3 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to Amazon ECR Public | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| registry-type: public | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: public.ecr.aws/b8k9c8n5/openmind/embedding_service | |
| tags: | | |
| type=semver,pattern={{version}},prefix=v | |
| type=semver,pattern={{major}}.{{minor}},prefix=v | |
| type=ref,event=branch | |
| type=sha | |
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
| type=raw,value=e5-small-v2-aarch64 | |
| - name: Build and push ARM64 image by digest | |
| id: build | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile.embed | |
| platforms: linux/arm64 | |
| labels: ${{ steps.meta.outputs.labels }} | |
| outputs: type=image,name=public.ecr.aws/b8k9c8n5/openmind/embedding_service,push-by-digest=true,name-canonical=true,push=true | |
| create-riva-manifest: | |
| runs-on: ubuntu-latest | |
| needs: [build-riva-arm64] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| deployments: write | |
| environment: | |
| name: ${{ startsWith(github.ref, 'refs/tags/v') && 'production-riva' || 'staging-riva' }} | |
| url: https://gallery.ecr.aws/b8k9c8n5/openmind/riva-speech-server | |
| steps: | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v3 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to Amazon ECR Public | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| registry-type: public | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Create manifest list and push | |
| run: | | |
| # Get the metadata from arm64 build to extract tags | |
| tags=$(echo '${{ needs.build-riva-arm64.outputs.metadata }}' | jq -r '.tags[]') | |
| # Create manifest for each tag | |
| for tag in $tags; do | |
| echo "Creating manifest for: $tag" | |
| docker buildx imagetools create \ | |
| --tag $tag \ | |
| public.ecr.aws/b8k9c8n5/openmind/riva-speech-server@${{ needs.build-riva-arm64.outputs.image-digest }} | |
| done | |
| create-embedding-manifest: | |
| runs-on: ubuntu-latest | |
| needs: [build-embedding-arm64] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| deployments: write | |
| environment: | |
| name: ${{ startsWith(github.ref, 'refs/tags/v') && 'production-embedding' || 'staging-embedding' }} | |
| url: https://gallery.ecr.aws/b8k9c8n5/openmind/embedding_service | |
| steps: | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v3 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to Amazon ECR Public | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| registry-type: public | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Create manifest list and push | |
| run: | | |
| tags=$(echo '${{ needs.build-embedding-arm64.outputs.metadata }}' | jq -r '.tags[]') | |
| for tag in $tags; do | |
| echo "Creating manifest for: $tag" | |
| docker buildx imagetools create \ | |
| --tag $tag \ | |
| public.ecr.aws/b8k9c8n5/openmind/embedding_service@${{ needs.build-embedding-arm64.outputs.image-digest }} | |
| done |