Add Docker image removal option

This commit is contained in:
Christian Harke
2023-06-01 08:18:27 +02:00
parent 76866dbe54
commit 0add001504
2 changed files with 20 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ jobs:
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
```
## Options
@@ -49,6 +50,7 @@ Here are a few sources of inspiration:
- https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh
- https://github.com/ShubhamTatvamasi/free-disk-space-action
- https://github.com/actions/virtual-environments/issues/2875#issuecomment-1163392159
- https://github.com/easimon/maximize-build-space/
## Typical Output

View File

@@ -27,6 +27,11 @@ inputs:
required: false
default: "true"
docker-images:
description: "Remove Docker images"
required: false
default: "true"
# option inspired by:
# https://github.com/actions/virtual-environments/issues/2875#issuecomment-1163392159
tool-cache:
@@ -180,6 +185,18 @@ runs:
printSavedSpace $SAVED "Large misc. packages"
fi
# Option: Remove Docker images
if [[ ${{ inputs.docker-images }} == 'true' ]]; then
BEFORE=$(getAvailableSpace)
sudo docker image prune --all --force
AFTER=$(getAvailableSpace)
SAVED=$((AFTER-BEFORE))
printSavedSpace $SAVED "Docker images"
fi
# Option: Remove tool cache
# REF: https://github.com/actions/virtual-environments/issues/2875#issuecomment-1163392159