Skip to content

Commit b598b58

Browse files
committed
get more space in action
1 parent c9131a7 commit b598b58

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

.github/workflows/docker-build-components.yaml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,34 @@ jobs:
2727
component: [hydromt, surrogate, wflow]
2828

2929
steps:
30+
- name: Show initial disk usage
31+
run: df -h
32+
33+
- name: Free up disk space and move Docker storage
34+
run: |
35+
echo "=== Cleaning up system to free space ==="
36+
sudo apt-get clean
37+
sudo apt-get autoremove -y
38+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
39+
40+
echo "=== Removing preinstalled Docker images and cache ==="
41+
docker image prune -af || true
42+
docker builder prune -af || true
43+
sudo rm -rf /var/lib/docker || true
44+
45+
echo "=== Moving Docker data to /mnt/docker for more space ==="
46+
sudo mkdir -p /mnt/docker
47+
sudo systemctl stop docker
48+
sudo rsync -aP /var/lib/docker/ /mnt/docker/ || true
49+
sudo rm -rf /var/lib/docker
50+
sudo ln -s /mnt/docker /var/lib/docker
51+
sudo systemctl start docker
52+
53+
echo "=== Running final cleanup ==="
54+
docker system prune -af --volumes || true
55+
echo "=== Disk usage after cleanup ==="
56+
df -h
57+
3058
- name: Checkout repository
3159
uses: actions/checkout@v4
3260

@@ -55,8 +83,19 @@ jobs:
5583
context: ./docker/${{ matrix.component }}
5684
file: ./docker/${{ matrix.component }}/Dockerfile
5785
push: true
86+
load: false
5887
tags: ${{ steps.meta.outputs.tags }}
5988
labels: ${{ steps.meta.outputs.labels }}
6089
platforms: linux/amd64
61-
cache-from: type=gha
62-
cache-to: type=gha,mode=max
90+
cache-from: type=gha,scope=${{ matrix.component }}
91+
cache-to: type=gha,mode=max,scope=${{ matrix.component }}
92+
build-args: |
93+
BUILDKIT_INLINE_CACHE=1
94+
95+
- name: Clean up after build
96+
if: always()
97+
run: |
98+
echo "=== Cleaning up after build ==="
99+
docker system prune -af --volumes || true
100+
echo "=== Final disk usage ==="
101+
df -h

0 commit comments

Comments
 (0)