From a6601f1c02e74addfd31966c22af9a13c5ac0ed4 Mon Sep 17 00:00:00 2001 From: Jonathan Karr Date: Sun, 10 Oct 2021 11:55:22 -0400 Subject: [PATCH] build: freeing disk space Docker image building --- .github/workflows/buildDockerImage.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildDockerImage.yml b/.github/workflows/buildDockerImage.yml index 162d658..a052a6f 100644 --- a/.github/workflows/buildDockerImage.yml +++ b/.github/workflows/buildDockerImage.yml @@ -9,8 +9,15 @@ jobs: runs-on: ubuntu-latest steps: + # Free disk space + - name: Free up disk space + run: sudo rm -rf /usr/share/dotnet + + # checkout repository - name: Checkout repository - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2 + with: + fetch-depth: 1 # Build Docker image - id: get-timestamp @@ -36,7 +43,12 @@ jobs: image_tag: ${{github.sha}} push_image_and_stages: true username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} - password: "${{ secrets.DOCKER_REGISTRY_TOKEN }}" + password: "${{ secrets.DOCKER_REGISTRY_TOKEN }}" + + - name: Clean up unnecessary images to free disk space + run: | + images=$(docker images | grep -v ${{github.sha}} | grep ago | awk '{print $3}') + docker rm -f $images - name: Label base Docker image run: | @@ -57,8 +69,15 @@ jobs: username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} password: "${{ secrets.DOCKER_REGISTRY_TOKEN }}" + - name: Clean up unnecessary images to free disk space + run: | + images=$(docker images | grep -v ${{github.sha}} | grep ago | awk '{print $3}') + docker rm -f $images + - name: Label Docker image run: | + docker image tag ghcr.io/biosimulators/biosimulators-base-stages:${{github.sha}} ghcr.io/biosimulators/biosimulators-base:${{github.sha}} + docker image tag ghcr.io/biosimulators/biosimulators-base-stages:${{github.sha}} ghcr.io/biosimulators/biosimulators-base:latest docker image tag ghcr.io/biosimulators/biosimulators-stages:${{github.sha}} ghcr.io/biosimulators/biosimulators:${{github.sha}} docker image tag ghcr.io/biosimulators/biosimulators-stages:${{github.sha}} ghcr.io/biosimulators/biosimulators:latest