Skip to content

Commit 3c2f5e2

Browse files
authored
fix: install Alpine runtime dependencies (#433)
## Summary - Install missing Alpine runtime libraries before setting up Bun on Linux musl containers - Keep non-musl and non-Linux runners as no-ops - Fail with a clear message if a musl container cannot install the required packages ## Testing - `bun test` - `bun run format:check && bun run lint && bun run typecheck` - Verified `supabase_2.100.0_linux_arm64.apk` fails on plain Alpine without `libstdc++`/`libgcc` and reports `2.100.0` after installing them
1 parent 365cb46 commit 3c2f5e2

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

action.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,51 @@ runs:
5050
5151
echo "url=https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-linux-${arch}-musl.zip" >> "$GITHUB_OUTPUT"
5252
53+
- name: Install Alpine Runtime Dependencies
54+
shell: sh
55+
run: |
56+
set -eu
57+
58+
if [ "${RUNNER_OS}" != "Linux" ]; then
59+
exit 0
60+
fi
61+
62+
is_musl=false
63+
if [ -f /etc/alpine-release ]; then
64+
is_musl=true
65+
elif command -v ldd >/dev/null 2>&1 && ldd --version 2>&1 | grep -qi musl; then
66+
is_musl=true
67+
fi
68+
69+
if [ "${is_musl}" != "true" ]; then
70+
exit 0
71+
fi
72+
73+
# Bun's musl binary and the Supabase CLI shim both dynamically link libstdc++ and libgcc.
74+
if command -v apk >/dev/null 2>&1; then
75+
missing_packages=""
76+
for package in libstdc++ libgcc; do
77+
if ! apk info -e "${package}" >/dev/null 2>&1; then
78+
missing_packages="${missing_packages} ${package}"
79+
fi
80+
done
81+
82+
if [ -z "${missing_packages}" ]; then
83+
exit 0
84+
fi
85+
86+
if [ "$(id -u)" != "0" ]; then
87+
echo "::error::Alpine/musl containers need${missing_packages} to run Supabase CLI. Add 'apk add --no-cache${missing_packages}' before supabase/setup-cli, or run this job container as root."
88+
exit 1
89+
fi
90+
91+
apk add --no-cache ${missing_packages}
92+
exit 0
93+
fi
94+
95+
echo "::error::Linux musl containers need libstdc++ and libgcc to run Supabase CLI. Install them before supabase/setup-cli."
96+
exit 1
97+
5398
- name: Setup Bun
5499
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
55100
with:

0 commit comments

Comments
 (0)