@@ -38,11 +38,40 @@ jobs:
3838 steps :
3939 - uses : actions/checkout@v4
4040
41+ # Add aggressive cleanup before any Docker operations
42+ - name : Free disk space
43+ run : |
44+ # Remove large unnecessary packages
45+ sudo apt-get remove -y '^dotnet-.*' '^llvm-.*' 'php.*' azure-cli google-cloud-sdk mongodb-org
46+ sudo apt-get autoremove -y
47+ sudo apt-get clean
48+
49+ # Remove large directories
50+ sudo rm -rf /usr/share/dotnet
51+ sudo rm -rf /usr/local/lib/android
52+ sudo rm -rf /opt/ghc
53+ sudo rm -rf /opt/hostedtoolcache
54+ sudo rm -rf /usr/local/.ghcup
55+ sudo rm -rf /usr/local/share/powershell
56+ sudo rm -rf /usr/local/share/chromium
57+
58+ # Clean Docker
59+ docker system prune -af
60+ docker image prune -af
61+ docker builder prune -af
62+
63+ df -h
64+
4165 - name : Set up QEMU
4266 uses : docker/setup-qemu-action@v3
4367
4468 - name : Set up Docker Buildx
4569 uses : docker/setup-buildx-action@v3
70+ with :
71+ driver-opts : |
72+ image=moby/buildkit:buildx-stable-1
73+ network=host
74+ buildkitd-flags : --debug
4675
4776 - name : Log in to GitHub Container Registry
4877 uses : docker/login-action@v3
@@ -64,29 +93,50 @@ jobs:
6493 type=semver,pattern={{major}}.{{minor}}
6594 type=raw,value=latest
6695
67- # Build and push proxy image
68- - name : Build and push proxy_only Docker image
96+ # Build and push proxy AMD64
97+ - name : Build and push proxy_only Docker image AMD64
6998 uses : docker/build-push-action@v5
7099 with :
71100 context : .
72101 file : Dockerfile.proxy_only
73102 push : true
74- platforms : linux/amd64,linux/arm64
103+ platforms : linux/amd64
75104 tags : ${{ steps.meta-proxy.outputs.tags }}
76105 labels : ${{ steps.meta-proxy.outputs.labels }}
77- cache-from : type=gha,scope=proxy
78- cache-to : type=gha,scope=proxy,mode=max
79-
80- # Add cleanup steps after proxy build
81- - name : Clean up disk space after proxy build
106+ cache-from : type=gha,scope=proxy-amd64
107+ cache-to : type=gha,scope=proxy-amd64,mode=max
108+ outputs : type=registry,compression=zstd,compression-level=5
109+
110+ # Cleanup after AMD64 build
111+ - name : Cleanup after AMD64 build
112+ run : |
113+ docker system prune -af
114+ docker builder prune -af
115+ df -h
116+
117+ # Build proxy ARM64
118+ - name : Build and push proxy_only Docker image ARM64
119+ uses : docker/build-push-action@v5
120+ with :
121+ context : .
122+ file : Dockerfile.proxy_only
123+ push : true
124+ platforms : linux/arm64
125+ tags : ${{ steps.meta-proxy.outputs.tags }}
126+ labels : ${{ steps.meta-proxy.outputs.labels }}
127+ cache-from : type=gha,scope=proxy-arm64
128+ cache-to : type=gha,scope=proxy-arm64,mode=max
129+ outputs : type=registry,compression=zstd,compression-level=5
130+
131+ # Cleanup after proxy builds
132+ - name : Cleanup after proxy builds
82133 run : |
83- # Remove all unused docker data including stopped containers, unused networks, dangling images, and build cache
84134 docker system prune -af
85- # Remove all unused build cache
86135 docker builder prune -af
87- # Clean only user-owned files in /tmp, ignore permission errors
88136 find /tmp -type f -user $(id -u) -exec rm -f {} + 2>/dev/null || true
137+ df -h
89138
139+ # Extract metadata for full image
90140 - name : Extract metadata for Docker
91141 id : meta
92142 uses : docker/metadata-action@v5
@@ -96,14 +146,36 @@ jobs:
96146 type=semver,pattern={{version}}
97147 type=semver,pattern={{major}}.{{minor}}
98148 latest
99-
100- - name : Build and push Docker image
149+
150+ # Build full image AMD64
151+ - name : Build and push Docker image AMD64
152+ uses : docker/build-push-action@v5
153+ with :
154+ context : .
155+ push : true
156+ platforms : linux/amd64
157+ tags : ${{ steps.meta.outputs.tags }}
158+ labels : ${{ steps.meta.outputs.labels }}
159+ cache-from : type=gha,scope=full-amd64
160+ cache-to : type=gha,scope=full-amd64,mode=max
161+ outputs : type=registry,compression=zstd,compression-level=5
162+
163+ # Cleanup between architectures
164+ - name : Cleanup between architectures
165+ run : |
166+ docker system prune -af
167+ docker builder prune -af
168+ df -h
169+
170+ # Build full image ARM64
171+ - name : Build and push Docker image ARM64
101172 uses : docker/build-push-action@v5
102173 with :
103174 context : .
104175 push : true
105- platforms : linux/amd64,linux/ arm64
176+ platforms : linux/arm64
106177 tags : ${{ steps.meta.outputs.tags }}
107178 labels : ${{ steps.meta.outputs.labels }}
108- cache-from : type=gha
109- cache-to : type=gha,mode=max
179+ cache-from : type=gha,scope=full-arm64
180+ cache-to : type=gha,scope=full-arm64,mode=max
181+ outputs : type=registry,compression=zstd,compression-level=5
0 commit comments