Repository navigation
Route agents to the guides that answer study, cancer-type and subtype… #105
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: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: "Git ref to build and tag the image (branch, tag, or commit SHA)" | |
| type: string | |
| required: true | |
| jobs: | |
| # Per-architecture build on a native runner. arm64 uses ubuntu-24.04-arm | |
| # (free on public repos), avoiding the ~5-10x slowdown of QEMU emulation. | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref != '' && github.event.inputs.ref || github.ref }} | |
| - name: Set image tag | |
| id: set-tag | |
| run: | | |
| if [ -n "${{ github.event.inputs.ref }}" ]; then | |
| echo "IMAGE_TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV | |
| else | |
| echo "IMAGE_TAG=latest" >> $GITHUB_ENV | |
| fi | |
| echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
| env: | |
| platform: ${{ matrix.platform }} | |
| - name: Log in to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push (by digest) | |
| id: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: docker/Dockerfile | |
| platforms: ${{ matrix.platform }} | |
| # Push by digest only; the merge job tags the final manifest. | |
| outputs: type=image,name=cbioportal/mcp,push-by-digest=true,name-canonical=true,push=true | |
| cache-from: type=gha,scope=${{ env.PLATFORM_PAIR }} | |
| cache-to: type=gha,scope=${{ env.PLATFORM_PAIR }},mode=max | |
| - 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 | |
| merge: | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set image tag | |
| run: | | |
| if [ -n "${{ github.event.inputs.ref }}" ]; then | |
| echo "IMAGE_TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV | |
| else | |
| echo "IMAGE_TAG=latest" >> $GITHUB_ENV | |
| fi | |
| - name: Download digests | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: /tmp/digests | |
| pattern: digests-* | |
| merge-multiple: true | |
| - name: Log in to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Create multi-arch manifest | |
| working-directory: /tmp/digests | |
| run: | | |
| docker buildx imagetools create -t cbioportal/mcp:${{ env.IMAGE_TAG }} \ | |
| $(printf 'cbioportal/mcp@sha256:%s ' *) | |
| - name: Inspect | |
| run: docker buildx imagetools inspect cbioportal/mcp:${{ env.IMAGE_TAG }} |