@@ -38,11 +38,40 @@ jobs:
38
38
steps :
39
39
- uses : actions/checkout@v4
40
40
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
+
41
65
- name : Set up QEMU
42
66
uses : docker/setup-qemu-action@v3
43
67
44
68
- name : Set up Docker Buildx
45
69
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
46
75
47
76
- name : Log in to GitHub Container Registry
48
77
uses : docker/login-action@v3
@@ -64,29 +93,50 @@ jobs:
64
93
type=semver,pattern={{major}}.{{minor}}
65
94
type=raw,value=latest
66
95
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
69
98
uses : docker/build-push-action@v5
70
99
with :
71
100
context : .
72
101
file : Dockerfile.proxy_only
73
102
push : true
74
- platforms : linux/amd64,linux/arm64
103
+ platforms : linux/amd64
75
104
tags : ${{ steps.meta-proxy.outputs.tags }}
76
105
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
82
133
run : |
83
- # Remove all unused docker data including stopped containers, unused networks, dangling images, and build cache
84
134
docker system prune -af
85
- # Remove all unused build cache
86
135
docker builder prune -af
87
- # Clean only user-owned files in /tmp, ignore permission errors
88
136
find /tmp -type f -user $(id -u) -exec rm -f {} + 2>/dev/null || true
137
+ df -h
89
138
139
+ # Extract metadata for full image
90
140
- name : Extract metadata for Docker
91
141
id : meta
92
142
uses : docker/metadata-action@v5
@@ -96,14 +146,36 @@ jobs:
96
146
type=semver,pattern={{version}}
97
147
type=semver,pattern={{major}}.{{minor}}
98
148
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
101
172
uses : docker/build-push-action@v5
102
173
with :
103
174
context : .
104
175
push : true
105
- platforms : linux/amd64,linux/ arm64
176
+ platforms : linux/arm64
106
177
tags : ${{ steps.meta.outputs.tags }}
107
178
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