Skip to content

Build and deploy docker image #15

Build and deploy docker image

Build and deploy docker image #15

name: Build and deploy docker image
on:
workflow_dispatch:
branches:
- 'develop'
- 'master'
- 'releases/*'
inputs:
version:
description: Application release version e.g. 1.0.0
type: string
required: true
push_to_acr:
description: Push to Azure registry?
type: boolean
default: false
jobs:
build-app:
name: Build docker image for APP
strategy:
matrix:
app: ["server","data-adapter","nextstep","push-server","webflow","tpp-engine"]
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
- name: Prepare Libs
run: |
wget --no-verbose https://download.oracle.com/otn-pub/otn_software/jdbc/233/ojdbc11.jar -O ${GITHUB_WORKSPACE}/deploy/lib/ojdbc11.jar
wget --no-verbose https://jdbc.postgresql.org/download/postgresql-42.7.1.jar -O ${GITHUB_WORKSPACE}/deploy/lib/postgresql.jar
- name: Get Powerauth Server WAR files
if: matrix.app == 'server'
run: |
wget --no-verbose https://${{ env.INTERNAL_USERNAME }}:${{ env.INTERNAL_PASSWORD }}@wultra.jfrog.io/artifactory/internal-maven-repository/io/getlime/security/powerauth-admin/${{ inputs.version }}/powerauth-admin-${{ inputs.version }}.war -O ${GITHUB_WORKSPACE}/deploy/images/powerauth-admin.war
wget --no-verbose https://${{ env.INTERNAL_USERNAME }}:${{ env.INTERNAL_PASSWORD }}@wultra.jfrog.io/artifactory/internal-maven-repository/io/getlime/security/powerauth-java-server/${{ inputs.version }}/powerauth-java-server-${{ inputs.version }}.war -O ${GITHUB_WORKSPACE}/deploy/images/powerauth-java-server.war
- name: Get Powerauth ${{ matrix.app }} WAR file
if: matrix.app != 'server'
run: |
wget --no-verbose https://${{ env.INTERNAL_USERNAME }}:${{ env.INTERNAL_PASSWORD }}@wultra.jfrog.io/artifactory/internal-maven-repository/io/getlime/security/powerauth-${{ matrix.app }}/${{ inputs.version }}/powerauth-${{ matrix.app }}-${{ inputs.version }}.war -O ${GITHUB_WORKSPACE}/deploy/images/powerauth-${{ matrix.app }}.war
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Azure registry
if: ${{ inputs.push_to_acr }}
uses: docker/login-action@v3
with:
registry: https://powerauth.azurecr.io/
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: "powerauth-server: Build${{ if inputs.push_to_acr }} and push${{ endif }} docker image${{ if inputs.push_to_acr } to Azure registry${{ endif }}."

Check failure on line 58 in .github/workflows/publish-docker-image.yml

View workflow run for this annotation

GitHub Actions / Build and deploy docker image

Invalid workflow file

The workflow is not valid. .github/workflows/publish-docker-image.yml (Line: 58, Col: 15): Unrecognized named-value: 'if'. Located at position 1 within expression: if inputs.push_to_acr
uses: docker/build-push-action@v5
with:
push: ${{ inputs.push_to_acr }}
platforms: linux/amd64,linux/arm64
tags: powerauth.azurecr.io/${{matrix.app}}:${{ inputs.version }}
file: ./docker-powerauth-${{matrix.app}}/Dockerfile
context: .
# - name: prepare ref to fetch liquibase files
# # SNAPSHOT is treated as develop branch i.e. latest
# run: |
# cd docker-powerauth-cloud
# PAS=`mvn help:evaluate -Dexpression=powerauth-java-server.version -q -DforceStdout`
# if [[ "$PAS" == *"SNAPSHOT"* ]]; then
# echo "to_fetch_pas=develop" >> $GITHUB_ENV
# else
# echo "to_fetch_pas=$PAS" >> $GITHUB_ENV
# fi
# ENR=`mvn help:evaluate -Dexpression=enrollment-server.version -q -DforceStdout`
# if [[ "$ENR" == *"SNAPSHOT"* ]]; then
# echo "to_fetch_enr=develop" >> $GITHUB_ENV
# else
# echo "to_fetch_enr=$ENR" >> $GITHUB_ENV
# fi
# PUSH=`mvn help:evaluate -Dexpression=powerauth-push-server.version -q -DforceStdout`
# if [[ "$PUSH" == *"SNAPSHOT"* ]]; then
# echo "to_fetch_push=develop" >> $GITHUB_ENV
# else
# echo "to_fetch_push=$PUSH" >> $GITHUB_ENV
# fi
# # run: echo "to_fetch=github.ref_name" >> $GITHUB_ENV
# - name: Get liquibase files from PAS
# uses: actions/checkout@v3
# with:
# repository: wultra/powerauth-server
# path: powerauth-server
# token: ${{ secrets.GH_PAC_PAT }}
# ref: ${{ env.to_fetch_pas }}
# - name: Get liquibase files from Enrollment Server
# uses: actions/checkout@v3
# with:
# repository: wultra/enrollment-server
# path: enrollment-server
# token: ${{ secrets.GH_PAC_PAT }}
# ref: ${{ env.to_fetch_enr }}
# - name: Get liquibase files from Push Server
# uses: actions/checkout@v3
# with:
# repository: wultra/powerauth-push-server
# path: powerauth-push-server
# token: ${{ secrets.GH_PAC_PAT }}
# ref: ${{ env.to_fetch_push }}
# - name: Copy liquibase files
# run: docker-powerauth-cloud/copy_liquibase.sh
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# with:
# install: true
# - name: Log in to JFrog registry
# if: ${{ github.event_name == 'workflow_dispatch' && inputs.jfrog_deploy == true }}
# uses: docker/login-action@v2
# with:
# registry: https://wultra.jfrog.io/
# username: ${{ secrets.JFROG_CONTAINER_REGISTRY_USERNAME }}
# password: ${{ secrets.JFROG_CONTAINER_REGISTRY_PASSWORD }}
# - name: Build and push container image to registry
# if: ${{ github.event_name == 'workflow_dispatch' && inputs.jfrog_deploy == true }}
# uses: docker/build-push-action@v3
# with:
# push: ${{ github.event_name == 'workflow_dispatch' && inputs.jfrog_deploy == true }}
# platforms: linux/amd64,linux/arm64
# tags: wultra.jfrog.io/wultra-docker/powerauth-cloud:${{ env.REVISION }}${{ env.TIMESTAMP }}
# file: ./docker-powerauth-cloud/Dockerfile
# context: .
# - name: Log in to Azure registry
# if: ${{ github.event_name == 'workflow_dispatch' }}
# uses: docker/login-action@v2
# with:
# registry: https://powerauth.azurecr.io/
# username: ${{ secrets.ACR_USERNAME }}
# password: ${{ secrets.ACR_PASSWORD }}
# - name: Build and push container image to Azure registry
# uses: docker/build-push-action@v3
# with:
# push: ${{ github.event_name == 'workflow_dispatch' }}
# platforms: linux/amd64,linux/arm64
# tags: powerauth.azurecr.io/powerauth-cloud:${{ env.REVISION }}${{ env.TIMESTAMP }}-${{ github.sha }}
# file: ./docker-powerauth-cloud/Dockerfile
# context: .
# - if: ${{ github.event_name == 'workflow_dispatch' }}
# run: |
# echo '### 🚀 Published images' >> $GITHUB_STEP_SUMMARY
# echo 'powerauth.azurecr.io/powerauth-cloud:${{ env.REVISION }}${{ env.TIMESTAMP }}-${{ github.sha }}' >> $GITHUB_STEP_SUMMARY
# - if: ${{ github.event_name == 'workflow_dispatch' && inputs.jfrog_deploy == true }}
# run: echo 'wultra.jfrog.io/wultra-docker/powerauth-cloud:${{ env.REVISION }}${{ env.TIMESTAMP }}' >> $GITHUB_STEP_SUMMARY