Build docker with args #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build docker with args | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: The commit SHA or tag for checking out code | |
default: '' | |
required: false | |
cargo_profile: | |
type: choice | |
description: which profile to use in cargo | |
options: | |
- release | |
- production | |
docker_tag: | |
description: The tag for the built docker image | |
required: true | |
args: | |
description: Args to pass to `cargo build`, e.g. --features=runtime-benchmarks | |
default: '' | |
required: false | |
env: | |
DOCKER_BUILDKIT: 1 | |
jobs: | |
## build docker image of client binary with args ## | |
build-docker-with-args: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout codes on ${{ github.event.inputs.ref || github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.ref || github.ref }} | |
fetch-depth: 0 | |
- name: Build docker image | |
run: | | |
./scripts/build-docker.sh ${{ github.event.inputs.cargo_profile }} ${{ github.event.inputs.docker_tag }} "${{ github.event.inputs.args }}" | |
echo "=============================" | |
docker images | |
- name: Dockerhub login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Push docker image | |
run: | | |
docker push litentry/litentry-parachain:${{ github.event.inputs.docker_tag }} | |
- name: Copy client binary to disk | |
run: | | |
docker cp $(docker create --rm litentry/litentry-parachain:${{ github.event.inputs.docker_tag }}):/usr/local/bin/litentry-collator . | |
- name: Upload the client binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: litentry-collator | |
path: | | |
litentry-collator |