File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 89
89
username : ${{ secrets.DOCKERHUB_LOGIN }}
90
90
password : ${{ secrets.DOCKERHUB_TOKEN }}
91
91
92
+ - name : Set build parameters
93
+ id : build-params
94
+ run : |
95
+ # Get available CPUs, use 75% for build, minimum 2
96
+ AVAILABLE_CPUS=$(nproc)
97
+ OPTIMAL_NPROC=$(( AVAILABLE_CPUS * 3 / 4 ))
98
+ OPTIMAL_NPROC=$(( OPTIMAL_NPROC > 1 ? OPTIMAL_NPROC : 2 ))
99
+
100
+ # ARM architectures might need special handling
101
+ if [[ "${{ matrix.arch }}" == *"arm"* ]]; then
102
+ # For ARM, be more conservative with resources
103
+ OPTIMAL_NPROC=$(( OPTIMAL_NPROC > 2 ? 2 : OPTIMAL_NPROC ))
104
+ fi
105
+
106
+ echo "nproc=${OPTIMAL_NPROC}" >> $GITHUB_OUTPUT
107
+
92
108
- name : Build image
93
109
uses : docker/build-push-action@v6
94
110
env :
@@ -102,6 +118,7 @@ jobs:
102
118
platforms : ${{ matrix.arch }}
103
119
build-args : |
104
120
ALPINE_VERSION=${{ env.ALPINE_VERSION }}
121
+ nproc=${{ steps.build-params.outputs.nproc }}
105
122
push : false
106
123
load : true
107
124
tags : |
You can’t perform that action at this time.
0 commit comments