diff --git a/README.md b/README.md index 1468239..bfdc332 100644 --- a/README.md +++ b/README.md @@ -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 @@ -1638,4 +1640,4 @@ overall: ******************************************************************************** => Saved 31GiB ******************************************************************************** -``` \ No newline at end of file +``` diff --git a/action.yml b/action.yml index fb141db..fd5b249 100644 --- a/action.yml +++ b/action.yml @@ -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