Skip to content

Commit c8c7164

Browse files
committed
fix: Build Linux binaries in Alpine containers for musl libc compatibility
- Use golang:1.25-alpine3.23 container for Linux builds - Install gcc, musl-dev, and sqlite-dev in Alpine - Binaries now link against musl libc instead of glibc - Compatible with Alpine-based runtime container - macOS builds continue using native runners This fixes the '/bin/sh: infer: not found' error when running the binary in the Alpine container. The issue was glibc/musl incompatibility.
1 parent 60538d6 commit c8c7164

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

.github/workflows/artifacts.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ jobs:
4646
go-version-file: 'go.mod'
4747
cache: true
4848

49-
- name: Install build dependencies (Linux)
50-
if: matrix.goos == 'linux'
51-
run: |
52-
sudo apt-get update
53-
sudo apt-get install -y gcc libsqlite3-dev
54-
5549
- name: Get version info
5650
id: version
5751
run: |
@@ -62,7 +56,18 @@ jobs:
6256
echo "commit=$COMMIT" >> $GITHUB_OUTPUT
6357
echo "date=$DATE" >> $GITHUB_OUTPUT
6458
65-
- name: Build binary
59+
- name: Build binary (Linux in Alpine container)
60+
if: matrix.goos == 'linux'
61+
run: |
62+
docker run --rm \
63+
-v $PWD:/workspace \
64+
-w /workspace \
65+
-e CGO_ENABLED=1 \
66+
golang:1.25-alpine3.23 \
67+
sh -c "apk add --no-cache gcc musl-dev sqlite-dev && go build -tags libsqlite3 -ldflags '-w -s -X github.com/inference-gateway/cli/cmd.version=${{ steps.version.outputs.version }} -X github.com/inference-gateway/cli/cmd.commit=${{ steps.version.outputs.commit }} -X github.com/inference-gateway/cli/cmd.date=${{ steps.version.outputs.date }}' -o infer-${{ matrix.goos }}-${{ matrix.goarch }} ."
68+
69+
- name: Build binary (macOS native)
70+
if: matrix.goos == 'darwin'
6671
env:
6772
CGO_ENABLED: ${{ matrix.cgo }}
6873
run: |

0 commit comments

Comments
 (0)