From 1a5c860dcf8360a4426021758ef39dc3d660e46d Mon Sep 17 00:00:00 2001 From: leonardomeireles55 Date: Mon, 3 Feb 2025 10:07:02 -0300 Subject: [PATCH] refactor: add cleanup steps for Docker Buildx cache in backend deployment workflow --- .github/scripts/cleanup_system.sh | 10 +++++----- .github/workflows/backend-deploy.yml | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/scripts/cleanup_system.sh b/.github/scripts/cleanup_system.sh index ffd220f..6fad4df 100644 --- a/.github/scripts/cleanup_system.sh +++ b/.github/scripts/cleanup_system.sh @@ -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 @@ -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 @@ -46,4 +46,4 @@ echo "=====================================" echo " Cleanup Complete " echo "=====================================" -exit 0 \ No newline at end of file +exit 0 diff --git a/.github/workflows/backend-deploy.yml b/.github/workflows/backend-deploy.yml index 4d5ee11..d69ac1c 100644 --- a/.github/workflows/backend-deploy.yml +++ b/.github/workflows/backend-deploy.yml @@ -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 @@ -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: