mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-04 11:55:51 +00:00
107 lines
3.3 KiB
YAML
107 lines
3.3 KiB
YAML
name: Build and publish Clio docker image
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
tags:
|
|
required: true
|
|
type: string
|
|
description: Comma separated tags for docker image
|
|
artifact_name:
|
|
type: string
|
|
description: Name of Github artifact to put into docker image
|
|
strip_binary:
|
|
type: boolean
|
|
description: Whether to strip clio binary
|
|
default: true
|
|
publish_image:
|
|
type: boolean
|
|
description: Whether to publish docker image
|
|
required: true
|
|
|
|
workflow_dispatch:
|
|
inputs:
|
|
tags:
|
|
required: true
|
|
type: string
|
|
description: Comma separated tags for docker image
|
|
clio_server_binary_url:
|
|
required: true
|
|
type: string
|
|
description: Url to download clio_server binary from
|
|
binary_sha256:
|
|
required: true
|
|
type: string
|
|
description: sha256 hash of the binary
|
|
strip_binary:
|
|
type: boolean
|
|
description: Whether to strip clio binary
|
|
default: true
|
|
|
|
jobs:
|
|
build_and_publish_image:
|
|
name: Build and publish image
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download Clio binary from artifact
|
|
if: ${{ inputs.artifact_name != null }}
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
name: ${{ inputs.artifact_name }}
|
|
path: ./docker/clio/artifact/
|
|
|
|
- name: Download Clio binary from url
|
|
if: ${{ inputs.clio_server_binary_url != null }}
|
|
shell: bash
|
|
run: |
|
|
wget "${{inputs.clio_server_binary_url}}" -P ./docker/clio/artifact/
|
|
if [ "$(sha256sum ./docker/clio/clio_server | awk '{print $1}')" != "${{inputs.binary_sha256}}" ]; then
|
|
echo "Binary sha256 sum doesn't match"
|
|
exit 1
|
|
fi
|
|
- name: Unpack binary
|
|
shell: bash
|
|
run: |
|
|
sudo apt update && sudo apt install -y tar unzip
|
|
cd docker/clio/artifact
|
|
artifact=$(find . -type f)
|
|
if [[ $artifact == *.zip ]]; then
|
|
unzip $artifact
|
|
elif [[ $artifact == *.tar.gz ]]; then
|
|
tar -xvf $artifact
|
|
fi
|
|
chmod +x ./clio_server
|
|
mv ./clio_server ../
|
|
cd ../
|
|
rm -rf ./artifact
|
|
|
|
- name: Strip binary
|
|
if: ${{ inputs.strip_binary }}
|
|
shell: bash
|
|
run: strip ./docker/clio/clio_server
|
|
|
|
- name: Set GHCR_REPO
|
|
id: set-ghcr-repo
|
|
run: |
|
|
echo "GHCR_REPO=$(echo ghcr.io/${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_OUTPUT}
|
|
|
|
- name: Build Docker image
|
|
uses: ./.github/actions/build_docker_image
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
|
DOCKERHUB_PW: ${{ secrets.DOCKERHUB_PW }}
|
|
with:
|
|
images: |
|
|
ghcr.io/${{ steps.set-ghcr-repo.outputs.GHCR_REPO }}/clio
|
|
${{ github.repository_owner == 'XRPLF' && 'rippleci/clio' || '' }}
|
|
push_image: ${{ inputs.publish_image }}
|
|
directory: docker/clio
|
|
tags: ${{ inputs.tags }}
|
|
platforms: linux/amd64
|
|
dockerhub_repo: ${{ github.repository_owner == 'XRPLF' && 'rippleci/clio' || '' }}
|
|
dockerhub_description: Clio is an XRP Ledger API server.
|