Build and Push Docker Image For OID4VC_VCI and OID4VP Auth #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
| name: Build and Push Docker Image For OID4VC_VCI and OID4VP Auth | |
| on: | |
| workflow_dispatch: | |
| env: | |
| IMAGE_NAME: datev-oid4vp-auth | |
| REGISTRY: ghcr.io | |
| DOCKERFILE_NAME: Dockerfile.oid4vc-dev | |
| BUILD_DOCKERFILE: Dockerfile | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Rename Dockerfile for branch build | |
| run: mv ${{ env.DOCKERFILE_NAME }} ${{ env.BUILD_DOCKERFILE }} | |
| - name: Set up Docker Buildx | |
| id: builder | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| install: true | |
| driver: docker-container | |
| driver-opts: image=moby/buildkit:latest | |
| - name: Cache Docker layers | |
| uses: actions/cache@v3 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ github.ref_name }} | |
| restore-keys: | | |
| ${{ runner.os }}-buildx-${{ github.ref_name }} | |
| - name: Login to GitHub Container Registry (GHCR) | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Git metadata | |
| id: gitmeta | |
| run: | | |
| echo "BRANCH=$(echo ${GITHUB_REF##*/} | tr '[:upper:]' '[:lower:]' | sed 's#/#-#g')" >> $GITHUB_ENV | |
| echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - name: Build and Push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./${{ env.BUILD_DOCKERFILE }} | |
| builder: ${{ steps.builder.outputs.name }} | |
| push: true | |
| tags: | | |
| ghcr.io/adorsys/${{ env.IMAGE_NAME }}:${{ env.BRANCH }}-${{ env.SHORT_SHA }} | |
| build-args: | | |
| KC_BRANCH=datev/develop | |
| cache-from: type=local,src=/tmp/.buildx-cache | |
| cache-to: type=local,dest=/tmp/.buildx-cache |