From 71a3e35d0b25744810738e0b200195b483a4ab2b Mon Sep 17 00:00:00 2001 From: Hans <11695964+hupling@users.noreply.github.com> Date: Mon, 1 Jul 2024 09:46:13 +0200 Subject: [PATCH] Create reuseable-template-build-image.yml --- .../reuseable-template-build-image.yml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/reuseable-template-build-image.yml diff --git a/.github/workflows/reuseable-template-build-image.yml b/.github/workflows/reuseable-template-build-image.yml new file mode 100644 index 0000000..76da1cb --- /dev/null +++ b/.github/workflows/reuseable-template-build-image.yml @@ -0,0 +1,47 @@ + build-image: + reusable_workflow_job: + inputs: + registry: + required: true + type: string + registry-password: + required: true + type: string + registry-username: + required: true + type: string + app-path: + required: true + type: string + + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Download a single artifact + uses: actions/download-artifact@v4 + with: + name: target + - name: Login to Registry + uses: docker/login-action@v3 + with: + registry: ${{ inputs.registry }} + username: ${{ inputs.registry-username }} + password: ${{ inputs.registry-password }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ inputs.registry }}/${{ github.repository }}${{ inputs.app-path }} + tags: | + type=raw,value=latest + labels: | + org.opencontainers.image.description=Siehe ${{ github.server_url }}/${{ github.repository }} + - name: Build and push image + uses: docker/build-push-action@v4 + with: + context: .${{ inputs.app-path }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}