work-board: build image via vite directly + npm install (fix TS7-native/rollup platform-binary break on alpine)

The @luxfi/ui migration bumped to TypeScript 7 (native) + Vite 8 (Rollup 4), both of which
ship platform-specific PREBUILT binaries as optionalDependencies. Two failures resulted in the
alpine CI build: (1) npm ci against a darwin-generated lock lacked the linux-musl variants, and
(2) the TS7 native compiler has no alpine/musl binary at all, so 'tsc --noEmit' can't run there.
Fix both the ecosystem-standard way (same as the dao-vote image): npm install resolves the
platform-correct optional deps on the linux build host, and the image builds the bundle with
vite directly (esbuild transpiles TS; the typecheck is a dev/CI-lint concern, verified locally).

Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
2026-07-19 00:05:03 -07:00
co-authored by Hanzo Dev
parent f0f4a4d6ca
commit 3ae57c4a80
+10 -2
View File
@@ -6,13 +6,21 @@
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
# `npm install` (not `npm ci`): TypeScript 7 and Rollup 4 ship platform-specific PREBUILT
# binaries as optionalDependencies, and a darwin-generated lock omits the linux-musl variants
# (npm prunes non-current-platform optional deps). `install` resolves the correct ones on the
# linux build host. Same non-frozen approach the dao-vote image uses (pnpm --no-frozen-lockfile).
RUN npm install --no-audit --no-fund
COPY . .
ARG VITE_BRAND=zoo
ENV VITE_BRAND=$VITE_BRAND
ARG VITE_RPC_URL=https://api.zoo.network/v1/bc/C/rpc
ENV VITE_RPC_URL=$VITE_RPC_URL
RUN npm run build
# Build the artifact with Vite directly (esbuild transpiles TS — no tsc). The `npm run build`
# script also runs `tsc --noEmit`, but the TypeScript 7 NATIVE compiler has no alpine/musl binary,
# so the typecheck can't run in this image. Typecheck is a dev/CI-lint concern; the image only
# needs the bundle. Mirrors the dao-vote image, which likewise builds via `vite build` only.
RUN ./node_modules/.bin/vite build
# Serve the static build with SPA fallback. No nginx/caddy — a minimal static server.
FROM node:22-alpine