mirror of
https://github.com/XRPLF/clio.git
synced 2026-06-03 16:56:45 +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@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.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@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ env.GITHUB_TOKEN }}
|
|
|
|
- uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
|
|
with:
|
|
cache-image: false
|
|
- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
|
|
|
|
- uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
|
|
id: meta
|
|
with:
|
|
images: ${{ inputs.images }}
|
|
tags: ${{ inputs.tags }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
|
|
with:
|
|
context: ${{ inputs.directory }}
|
|
platforms: ${{ inputs.platforms }}
|
|
push: ${{ inputs.push_image == 'true' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
build-args: ${{ inputs.build_args }}
|