Skip to content

Commit

Permalink
Create reuseable-template-build-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
hupling authored Jul 1, 2024
1 parent acf162a commit 71a3e35
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/reuseable-template-build-image.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 71a3e35

Please sign in to comment.