mirror of
https://github.com/XRPLF/clio.git
synced 2026-09-29 00:18:12 +00:00
69 lines
2.2 KiB
YAML
69 lines
2.2 KiB
YAML
name: Build and push Docker image
|
|
description: Build and push Docker image to DockerHub and GitHub Container Registry
|
|
|
|
inputs:
|
|
images:
|
|
description: Name of the images to use as a base name
|
|
required: true
|
|
push_image:
|
|
description: Whether to push the image to the registry (true/false)
|
|
required: true
|
|
directory:
|
|
description: The directory containing the Dockerfile
|
|
required: true
|
|
tags:
|
|
description: Comma separated tags to apply to the image
|
|
required: true
|
|
platforms:
|
|
description: Platforms to build the image for (e.g. linux/amd64,linux/arm64)
|
|
required: true
|
|
build_args:
|
|
description: List of build-time variables
|
|
required: false
|
|
|
|
dockerhub_repo:
|
|
description: DockerHub repository name
|
|
required: false
|
|
default: ""
|
|
dockerhub_description:
|
|
description: Short description of the image
|
|
required: false
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Login to DockerHub
|
|
if: ${{ inputs.push_image == 'true' && inputs.dockerhub_repo != '' }}
|
|
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
|
with:
|
|
username: ${{ env.DOCKERHUB_USER }}
|
|
password: ${{ env.DOCKERHUB_PW }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
if: ${{ inputs.push_image == 'true' }}
|
|
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ env.GITHUB_TOKEN }}
|
|
|
|
- uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
|
|
with:
|
|
cache-image: false
|
|
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
|
|
|
|
- uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
|
|
id: meta
|
|
with:
|
|
images: ${{ inputs.images }}
|
|
tags: ${{ inputs.tags }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
|
with:
|
|
context: ${{ inputs.directory }}
|
|
platforms: ${{ inputs.platforms }}
|
|
push: ${{ inputs.push_image == 'true' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
build-args: ${{ inputs.build_args }}
|