Initial commit
This commit is contained in:
40
docker-build-push/action.yml
Normal file
40
docker-build-push/action.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
name: Docker Build and Push
|
||||
description: Extract metadata, build and push Docker image to git.sebse.de
|
||||
|
||||
inputs:
|
||||
image:
|
||||
description: Full image name, e.g. git.sebse.de/sebse/my-app
|
||||
required: true
|
||||
context:
|
||||
description: Docker build context path
|
||||
required: true
|
||||
dockerfile:
|
||||
description: Path to Dockerfile (optional, defaults to context/Dockerfile)
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ inputs.image }}
|
||||
tags: |
|
||||
type=sha,prefix=,format=short
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Setup Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ${{ inputs.context }}
|
||||
file: ${{ inputs.dockerfile != '' && inputs.dockerfile || format('{0}/Dockerfile', inputs.context) }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=${{ inputs.image }}:latest
|
||||
cache-to: type=inline
|
||||
Reference in New Issue
Block a user