Skip to content

Commit 414922a

Browse files
committed
feat(ci): use Alpine Docker container for smol musl builds
Added Docker-based Alpine builds for smol binaries to produce native musl binaries instead of glibc. Changes: - Split build step into two: standard platforms and Alpine - Alpine builds run in alpine:3.19 Docker container - Uses --platform flag for correct architecture (amd64 for x64, arm64) - Installs all required build tools in Alpine: nodejs, npm, pnpm, python3, make, g++, linux-headers, git, ccache, ninja Why Docker over QEMU/setup-alpine: - Faster: Native execution for x64, QEMU only for Alpine container (not compilation) - Simpler: One command, no complex setup - Reliable: Official Alpine images, true musl environment - arm64: Avoids full system emulation during Node.js compilation Expected build times: - x64 Alpine: ~50-60 minutes (native speed) - arm64 Alpine: ~90-120 minutes (minimal QEMU overhead) This ensures Alpine builds produce proper musl binaries that work on Alpine Linux and other musl-based systems.
1 parent fadc23e commit 414922a

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/build-smol.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,24 @@ jobs:
285285
if: (steps.smol-cache-valid.outputs.valid != 'true' || inputs.force) && matrix.platform == 'win32' && steps.ninja-cache-windows.outputs.cache-hit != 'true'
286286
run: choco install ninja
287287

288-
- name: Build smol binary
289-
if: steps.smol-cache-valid.outputs.valid != 'true' || inputs.force
288+
- name: Build smol binary (Standard platforms)
289+
if: (steps.smol-cache-valid.outputs.valid != 'true' || inputs.force) && matrix.platform != 'alpine'
290290
run: pnpm --filter @socketbin/node-smol-builder run build
291291

292+
- name: Build smol binary (Alpine - Docker)
293+
if: (steps.smol-cache-valid.outputs.valid != 'true' || inputs.force) && matrix.platform == 'alpine'
294+
run: |
295+
docker run --rm \
296+
--platform linux/${{ matrix.arch == 'x64' && 'amd64' || 'arm64' }} \
297+
-v $PWD:/workspace \
298+
-w /workspace \
299+
alpine:3.19 \
300+
sh -c "
301+
apk add --no-cache nodejs npm python3 make g++ linux-headers git ccache ninja && \
302+
npm install -g pnpm@10.16.0 && \
303+
pnpm --filter @socketbin/node-smol-builder run build
304+
"
305+
292306
- name: Verify smol binary
293307
shell: bash
294308
run: |

0 commit comments

Comments
 (0)