Docker: solve polkadot relay folder renaming and other small fixes #144
Workflow file for this run
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: Docker Build | |
on: | |
# Keep in mind the Docker tagging on the "metadata" step if you add new triggers | |
push: | |
branches: [main] | |
release: | |
types: [unpublished] # GITHUB_REF == tag pushed with the release | |
pull_request: | |
paths: | |
- ".github/workflows/build-docker.yml" | |
- "docker/centrifuge-chain/Dockerfile" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}${{ github.event_name }} | |
cancel-in-progress: true | |
jobs: | |
docker: | |
strategy: | |
matrix: | |
target: [ release, test ] | |
runs-on: ubuntu-latest-8-cores | |
steps: | |
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 #v3 | |
- name: DockerHub Login | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- run: echo "NOW=$(date -u +%y-%m-%d)" >> $GITHUB_ENV | |
- name: Setup docker metadata | |
id: meta | |
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 #v5 | |
with: | |
images: centrifugeio/centrifuge-chain | |
tags: | | |
type=semver,pattern={{raw}},prefix=${{ matrix.target == 'test' && 'test-' || '' }} | |
type=semver,value=latest,enable=${{ github.event_name == 'release' }} | |
type=edge,event=pr,suffix=-{{sha}}-${{ env.NOW }},prefix=${{ matrix.target == 'test' && 'test-' || '' }} | |
type=ref,event=tag,suffix=-{{sha}}-${{ env.NOW }},prefix=${{ matrix.target == 'test' && 'test-' || '' }} | |
type=ref,event=pr,suffix=-{{sha}}-${{ env.NOW }},prefix=${{ matrix.target == 'test' && 'test-' || '' }}PR | |
type=ref,event=branch,prefix=${{ matrix.target == 'test' && 'test-' || '' }},suffix=-{{sha}}-${{ env.NOW }} | |
- name: Configure GHA cache | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v6 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Build and push centrifugeio/centrifuge-chain | |
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 #v5 | |
with: | |
context: . | |
file: ./docker/centrifuge-chain/Dockerfile | |
build-args: | | |
FEATURES=${{ matrix.target == 'test' && 'fast-runtime' || '' }} | |
# push: ${{ github.event_name != 'pull_request' }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
# Cache options: | |
# https://docs.docker.com/build/ci/github-actions/cache/ | |
cache-from: type=gha | |
# cache-from: type=registry,ref=centrifugeio/centrifuge-chain:${{ github.ref }} | |
# https://docs.docker.com/build/cache/backends/inline/ | |
cache-to: type=gha, mode=max | |
# cache-to: type=registry,ref=centrifugeio/centrifuge-chain:${{ github.ref }}, mode=max | |
- name: Update DockerHub descriptions | |
if: contains(github.ref, 'refs/tags/release-v') | |
uses: peter-evans/dockerhub-description@dc67fad7001ef9e8e3c124cb7a64e16d0a63d864 #v3.4.2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
repository: centrifuge/centrifuge-chain | |
short-description: ${{ github.event.repository.description }} | |
enable-url-completion: true | |
- if: failure() | |
name: Check available space after build failed | |
run: | | |
docker volume ls | |
df -h |