Skip to content

Commit

Permalink
refactor: add cleanup steps for Docker Buildx cache in backend deploy…
Browse files Browse the repository at this point in the history
…ment workflow
  • Loading branch information
LeonardoMeireles55 committed Feb 3, 2025
1 parent 3a603e8 commit 1a5c860
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/scripts/cleanup_system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo " Starting System Cleanup "
echo "====================================="
echo "Clearing system cache..."
sync
echo 3 > /proc/sys/vm/drop_caches
echo 3 >/proc/sys/vm/drop_caches

echo "Memory usage after cleanup:"
free -h
Expand All @@ -31,13 +31,13 @@ echo " Starting APT Cleanup "
echo "====================================="

echo "Cleaning APT cache..."
sudo apt-get clean -y
apt-get clean -y

echo "Removing unused packages..."
sudo apt-get autoremove -y
apt-get autoremove -y

echo "Removing old downloaded archive files..."
sudo apt-get autoclean -y
apt-get autoclean -y

echo "Current disk usage:"
df -h
Expand All @@ -46,4 +46,4 @@ echo "====================================="
echo " Cleanup Complete "
echo "====================================="

exit 0
exit 0
8 changes: 7 additions & 1 deletion .github/workflows/backend-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: remove buildx cache
run: rm -rf /tmp/.buildx-cache

- name: Clean up Docker Buildx
run: docker buildx prune --volumes --all --force

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down Expand Up @@ -116,7 +122,7 @@ jobs:
- uses: actions/checkout@v4
- name: Running cleanup script
run: |
chmod +x ./.github/scripts/cleanup_system.sh
chmod 777 ./.github/scripts/cleanup_system.sh
./.github/scripts/cleanup_system.sh
notify:
Expand Down

0 comments on commit 1a5c860

Please sign in to comment.