Merge pull request #46 from Breeding-Insight/bug/BI-2422 #58
This file contains 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 | |
on: | |
push: | |
branches: | |
- develop | |
- release/** | |
- brapi-server-v2 | |
workflow_dispatch: | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Extract branch name | |
shell: bash | |
run: echo ::set-output name=branch::$(echo ${GITHUB_REF#refs/heads/}) | |
id: extract_branch | |
- run: git pull origin ${{steps.extract_branch.outputs.branch}} | |
- name: Set up JDK 8 | |
uses: actions/[email protected] | |
with: | |
java-version: 8 | |
- name: Build with Maven | |
run: mvn clean install | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,arm,amd64,amd' | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Set tag | |
id: vars | |
run: echo ::set-output name=imageName::$(echo breedinginsight/brapi-java-server:${{ github.run_number }}) | |
- name: Tag develop | |
if: steps.extract_branch.outputs.branch == 'develop' | |
run: echo "streamName=breedinginsight/brapi-java-server:develop" >> $GITHUB_ENV | |
- name: Tag release candidate | |
if: contains(github.ref, '/release/') | |
run: echo "streamName=breedinginsight/brapi-java-server:rc" >> $GITHUB_ENV | |
- name: Tag latest | |
if: steps.extract_branch.outputs.branch == 'brapi-server-v2' | |
run: echo "streamName=breedinginsight/brapi-java-server:latest" >> $GITHUB_ENV | |
- name: Build Docker and push image | |
run: | | |
docker buildx build . --file Dockerfile --tag ${{steps.vars.outputs.imageName}} --tag ${{env.streamName}} --push --platform=linux/arm64,linux/amd64 |