devops/build-docker/action.yaml
2025-08-03 13:02:19 +03:00

46 lines
1.3 KiB
YAML

name: "Build and push docker image"
description: "Run podman build and push to regestry"
inputs:
image_name: # id of input
description: "Name of image"
required: true
tags: # id of input
description: "Tags of image"
required: true
context:
description: "Docker directory location"
default: "."
# outputs:
# random-number:
# description: "Random number"
# value: ${{ steps.random-number-generator.outputs.random-number }}
runs:
using: "composite"
steps:
- name: Print Image Name
shell: bash
run: "echo 'ImageName: ${{ vars.DOCKER_REGISTRY_HOST }}/${{ inputs.image_name }}:${{ inputs.tags }}'"
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
env:
RUNNER_OS: Linux
with:
image: ${{ inputs.image_name }}
tags: ${{ inputs.tags }}
containerfiles: |
${{ inputs.context }}/Dockerfile
oci: true
tls-verify: false
context: ${{ inputs.context }}
- name: Push To Repository
id: push-to-repository
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ inputs.image_name }}
tags: ${{ inputs.tags }}
registry: ${{ vars.DOCKER_REGISTRY_HOST }}
username: ${{ vars.DOCKER_REGISTRY_USERNAME }}
password: ${{ vars.DOCKER_REGISTRY_PASSWORD }}