worker-image #6
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
| # Builds the 1000genome worker image, and publishes it when the change lands on | |
| # main. The image tag encodes the job-executor version (1.3-je1.4.1), so merging | |
| # a Renovate bump of worker-image/Makefile is what produces a new tag. | |
| name: worker-image | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'worker-image/**' | |
| - 'worker-base-image/**' | |
| - '.github/workflows/worker-image.yml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'worker-image/**' | |
| - 'worker-base-image/**' | |
| - '.github/workflows/worker-image.yml' | |
| workflow_dispatch: | |
| inputs: | |
| push: | |
| description: 'Push the built image to Docker Hub' | |
| type: boolean | |
| default: false | |
| jobs: | |
| worker-image: | |
| runs-on: ubuntu-22.04 | |
| env: | |
| # Publish on a main-branch push, or when a manual run asks for it. | |
| DO_PUSH: ${{ github.event_name == 'push' || inputs.push }} | |
| # A missing secret would otherwise fail the login step on forks. | |
| HAVE_DOCKERHUB: ${{ secrets.DOCKERHUB_USERNAME != '' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Log in before building: pulling the base image counts against the | |
| # anonymous Docker Hub rate limit, which shared runners routinely exhaust. | |
| - name: Login to Docker Hub | |
| if: env.HAVE_DOCKERHUB == 'true' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| # The base carries the analysis scripts and worker-image builds FROM it, | |
| # so build it here rather than pulling: a change to scripts/ bumps the | |
| # base version, and the new tag exists nowhere until this job pushes it. | |
| - name: Build base image | |
| run: make -C worker-base-image image | |
| - name: Build worker image | |
| run: make -C worker-image image | |
| - name: Show built tags | |
| run: docker images 'hyperflowwms/1000genome-worker*' | |
| # Both images are published: a rebuild of worker-image outside CI | |
| # resolves its FROM against the registry. | |
| - name: Push base image | |
| if: env.DO_PUSH == 'true' && env.HAVE_DOCKERHUB == 'true' | |
| run: make -C worker-base-image push-only | |
| - name: Push worker image | |
| if: env.DO_PUSH == 'true' && env.HAVE_DOCKERHUB == 'true' | |
| run: make -C worker-image push |