Skip to content

Upgrade 1020 (#1522) #717

Upgrade 1020 (#1522)

Upgrade 1020 (#1522) #717

Workflow file for this run

name: docker
on:
push:
branches: [main, 'release-v**']
pull_request:
paths:
- ".github/workflows/docker.yml"
workflow_dispatch:
inputs:
docker_tag:
description: 'Docker Image tag'
required: true
default: ''
env:
RUST_TOOLCHAIN: "nightly-2022-11-14"
jobs:
docker:
strategy:
matrix:
os: [ ubuntu-latest-4-cores ]
target: [ release, test ]
runs-on: ${{ matrix.os }}
env:
WORKFLOW_TAG: ${{ github.event.inputs.docker_tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Free space
# https://github.com/actions/runner-images/issues/2840#issuecomment-1284059930
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: check available docker space
run: |
docker volume ls
df -h
- name: Set docker tag
run: |
if [ "${WORKFLOW_TAG}" != "" ]; then
echo "DOCKER_TAG=${WORKFLOW_TAG}" >> $GITHUB_ENV
else
echo "DOCKER_TAG=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
fi
- if: matrix.target == 'release'
name: Build docker release
run: docker build --build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} -t centrifugeio/centrifuge-chain:${{ env.DOCKER_TAG }}-latest .
- if: matrix.target == 'test'
name: Build docker test
run: docker build --build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} --build-arg OPTS="--features=fast-runtime" -t centrifugeio/centrifuge-chain:test-${{ env.DOCKER_TAG }}-latest .
- if: failure()
name: Check available space after build failed
run: |
docker volume ls
df -h
- name: Login to Docker Hub
uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- if: matrix.target == 'release'
name: Tag image release
run: docker tag centrifugeio/centrifuge-chain:${{ env.DOCKER_TAG }}-latest "centrifugeio/centrifuge-chain:${{ env.DOCKER_TAG }}-$(date -u +%Y%m%d%H%M%S)-$(git rev-parse --short HEAD)"
- if: matrix.target == 'test'
name: Tag image test
run: docker tag centrifugeio/centrifuge-chain:test-${{ env.DOCKER_TAG }}-latest "centrifugeio/centrifuge-chain:test-${{ env.DOCKER_TAG }}-$(date -u +%Y%m%d%H%M%S)-$(git rev-parse --short HEAD)"
- name: List images
run: docker images
- name: Push image to Docker Hub
run: docker push --all-tags --quiet centrifugeio/centrifuge-chain
if: contains(github.ref, 'refs/tags/release-v') || github.ref == 'refs/heads/main'