Skip to content

Commit

Permalink
Add Docker image removal option
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Jun 1, 2023
1 parent 76866db commit 0add001
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
```
## Options
Expand All @@ -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

Expand Down Expand Up @@ -1638,4 +1640,4 @@ overall:
********************************************************************************
=> Saved 31GiB
********************************************************************************
```
```
17 changes: 17 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0add001

Please sign in to comment.