-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add action of free up disk space (including move docker data directory)
Signed-off-by: helenxie-bit <[email protected]>
- Loading branch information
1 parent
b5cae0d
commit a785d35
Showing
4 changed files
with
52 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Free-Up Disk Space | ||
description: Remove Non-Essential Tools And Move Docker Data Directory to /mnt/docker | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
# This step is a Workaround to avoid the "No space left on device" error. | ||
# ref: https://github.com/actions/runner-images/issues/2840 | ||
- name: Remove unnecessary files | ||
shell: bash | ||
run: | | ||
echo "Disk usage before cleanup:" | ||
df -hT | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf /usr/local/share/boost | ||
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /usr/local/share/powershell | ||
sudo rm -rf /usr/share/swift | ||
echo "Disk usage after cleanup:" | ||
df -hT | ||
- name: Prune docker images | ||
shell: bash | ||
run: | | ||
docker image prune -a -f | ||
docker system df | ||
df -hT | ||
- name: Move docker data directory | ||
shell: bash | ||
run: | | ||
echo "Stopping docker service ..." | ||
sudo systemctl stop docker | ||
DOCKER_DEFAULT_ROOT_DIR=/var/lib/docker | ||
DOCKER_ROOT_DIR=/mnt/docker | ||
echo "Moving ${DOCKER_DEFAULT_ROOT_DIR} -> ${DOCKER_ROOT_DIR}" | ||
sudo mv ${DOCKER_DEFAULT_ROOT_DIR} ${DOCKER_ROOT_DIR} | ||
echo "Creating symlink ${DOCKER_DEFAULT_ROOT_DIR} -> ${DOCKER_ROOT_DIR}" | ||
sudo ln -s ${DOCKER_ROOT_DIR} ${DOCKER_DEFAULT_ROOT_DIR} | ||
echo "$(sudo ls -l ${DOCKER_DEFAULT_ROOT_DIR})" | ||
echo "Starting docker service ..." | ||
sudo systemctl daemon-reload | ||
sudo systemctl start docker | ||
echo "Docker service status:" | ||
sudo systemctl --no-pager -l -o short status docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters