Update README.md #16
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: Docker Build, Test and Push | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| inputs: | |
| build_base: | |
| description: 'Build base image' | |
| type: boolean | |
| required: true | |
| default: false | |
| env: | |
| DOCKER_IMAGE: predig | |
| DOCKER_BASE_IMAGE: predig-base | |
| DOCKER_HUB_REPO: ${{ secrets.DOCKER_HUB_USERNAME }}/predig | |
| DOCKER_HUB_BASE_REPO: ${{ secrets.DOCKER_HUB_USERNAME }}/predig-base | |
| jobs: | |
| build-base: | |
| runs-on: self-hosted | |
| if: github.event_name == 'workflow_dispatch' && inputs.build_base | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build base image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Base.Dockerfile | |
| load: true | |
| tags: ${{ env.DOCKER_BASE_IMAGE }}:latest | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Push base image to Docker Hub | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Base.Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.DOCKER_HUB_BASE_REPO }}:latest | |
| ${{ env.DOCKER_HUB_BASE_REPO }}:${{ github.sha }} | |
| build-test-push: | |
| runs-on: self-hosted | |
| if: github.event_name != 'workflow_dispatch' || !inputs.build_base | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Decompress IEDB data | |
| run: | | |
| mkdir -p Immuno/Neoantigens-NOAH/noah/data | |
| unzip -o IEDB_data.csv.zip -d Immuno/Neoantigens-NOAH/noah/data/ | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build final image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| load: true | |
| tags: ${{ env.DOCKER_IMAGE }}:latest | |
| - name: Run tests | |
| run: | | |
| wget https://ftp.ebi.ac.uk/pub/databases/uniprot/knowledgebase/uniprot_sprot.fasta.gz -O uniprot_sprot.fasta.gz | |
| mkdir -p uniprot | |
| gunzip -c uniprot_sprot.fasta.gz > uniprot/uniprot_sprot.fasta | |
| chmod +x ./test.sh | |
| ./test.sh | |
| - name: Login to Docker Hub | |
| if: github.event_name == 'push' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Push final image to Docker Hub | |
| if: github.event_name == 'push' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.DOCKER_HUB_REPO }}:latest | |
| ${{ env.DOCKER_HUB_REPO }}:${{ github.sha }} |