initial: action/image-build @v1
This commit is contained in:
+47
@@ -0,0 +1,47 @@
|
||||
name: Build Image
|
||||
description: Build a container image locally with buildx and optionally run a smoke test. Does not push to registry.
|
||||
inputs:
|
||||
image:
|
||||
description: Full image name without tag (e.g. code.fritzlab.net/fritzlab/chrony)
|
||||
required: true
|
||||
context:
|
||||
description: Docker build context path
|
||||
required: false
|
||||
default: .
|
||||
build-args:
|
||||
description: Multiline KEY=VALUE pairs passed to docker build
|
||||
required: false
|
||||
smoke-test:
|
||||
description: |
|
||||
Shell command run after build. The image is exposed as $IMAGE
|
||||
(e.g. "docker run --rm --entrypoint /usr/sbin/chronyd $IMAGE -v").
|
||||
Empty = no test.
|
||||
required: false
|
||||
default: ''
|
||||
outputs:
|
||||
tag:
|
||||
description: Numeric tag assigned to the built image (= github.run_number)
|
||||
value: ${{ github.run_number }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Build (load to local docker)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ${{ inputs.context }}
|
||||
push: false
|
||||
load: true
|
||||
provenance: false
|
||||
network: host
|
||||
build-args: ${{ inputs.build-args }}
|
||||
tags: ${{ inputs.image }}:${{ github.run_number }}
|
||||
|
||||
- name: Smoke test
|
||||
if: ${{ inputs.smoke-test != '' }}
|
||||
shell: bash
|
||||
env:
|
||||
IMAGE: ${{ inputs.image }}:${{ github.run_number }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "+ ${{ inputs.smoke-test }}"
|
||||
${{ inputs.smoke-test }}
|
||||
Reference in New Issue
Block a user