Merge pull request #557 from wultra/feature/add-docker-build-for-fido2 #8
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: Build and push docker image of Powerauth Fido2 Demo to Docker registry | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- 'develop' | |
- 'main' | |
- 'releases/*' | |
paths: | |
- 'powerauth-fido2-tests/**' | |
push: | |
branches: | |
- 'develop' | |
paths: | |
- 'powerauth-fido2-tests/**' | |
jobs: | |
build: | |
runs-on: 'ubuntu-latest' | |
environment: docker-publish | |
env: | |
# these are global secrets - for readonly access to artifactory | |
INTERNAL_USERNAME: ${{ secrets.JFROG_USERNAME }} | |
INTERNAL_PASSWORD: ${{ secrets.JFROG_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: powerauth-fido2-tests | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
server-id: jfrog-central | |
server-username: INTERNAL_USERNAME | |
server-password: INTERNAL_PASSWORD | |
- name: Get version | |
run: | | |
cd powerauth-fido2-tests | |
REVISION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout` | |
echo "REVISION=$REVISION" >> $GITHUB_ENV | |
- name: Build war | |
run: | | |
cd powerauth-fido2-tests | |
mvn -U -DuseInternalRepo=true --no-transfer-progress package | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
- name: Log in to Azure registry | |
if: ${{ github.actor != 'dependabot[bot]' && (github.event_name == 'workflow_dispatch' || github.event_name == 'push') }} | |
uses: docker/login-action@v3 | |
with: | |
registry: https://powerauth.azurecr.io/ | |
username: ${{ vars.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
- name: Build and push container image to Azure registry | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ github.actor != 'dependabot[bot]' && (github.event_name == 'workflow_dispatch' || github.event_name == 'push') }} | |
platforms: linux/amd64,linux/arm64 | |
tags: powerauth.azurecr.io/powerauth-fido2-tests:${{ github.sha }} | |
file: ./powerauth-fido2-tests/docker-powerauth-fido2-tests/Dockerfile | |
context: ./powerauth-fido2-tests | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- if: ${{ github.actor != 'dependabot[bot]' && (github.event_name == 'workflow_dispatch' || github.event_name == 'push') }} | |
run: | | |
echo '### 🚀 Published images' >> $GITHUB_STEP_SUMMARY | |
echo 'powerauth.azurecr.io/powerauth-fido2-tests:${{ github.sha }}' >> $GITHUB_STEP_SUMMARY |