Skip to content

Commit b0c5551

Browse files
fix(docker): add native-gyp toolchain for alpine pnpm install
Native-gyp postinstalls (better-sqlite3, cpu-features, etc.) require python3/make/g++ which aren't in oven/bun:1-alpine by default. The previous `|| true` had been silently masking these install failures. Now that we surface them, the build correctly fails — fix by adding the toolchain to the builder stage so native compiles succeed. Build deps stay in the builder stage only; the runtime stage uses a fresh oven/bun:1-alpine without the toolchain, keeping the final image small.
1 parent f4d7c5a commit b0c5551

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

examples/Dockerfile.harness

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@
2222
FROM oven/bun:1-alpine AS builder
2323
WORKDIR /app
2424

25-
# git for any postinstall + the workspace install. pnpm comes via bun's
26-
# global install since the alpine bun image has no npm.
27-
RUN apk add --no-cache git \
25+
# git for any postinstall, plus python3/make/g++ so native-gyp deps
26+
# (better-sqlite3, cpu-features, etc.) can compile on alpine. Without
27+
# the toolchain, `pnpm install --frozen-lockfile` exits non-zero on the
28+
# first native postinstall. pnpm comes via bun's global install since
29+
# the alpine bun image has no npm.
30+
RUN apk add --no-cache git python3 make g++ pkgconfig \
2831
&& bun install -g pnpm@9.4.0
2932
ENV PATH="/root/.bun/install/global/node_modules/.bin:$PATH"
3033

0 commit comments

Comments
 (0)