Skip to content

Commit 59c4064

Browse files
chore: replace bun with node since bun keeps crashing (#1467)
#1331 --------- Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
1 parent 8b02260 commit 59c4064

File tree

5 files changed

+26
-59
lines changed

5 files changed

+26
-59
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dockerfile": "Dockerfile",
55
"args": {
66
"TOOLS_GO_VERSION": "1.25.5",
7-
"TOOLS_NODE_VERSION": "22.15.0",
7+
"TOOLS_NODE_VERSION": "24.13.0",
88
"TOOLS_UV_VERSION": "0.7.2",
99
"TOOLS_K9S_VERSION": "0.50.4",
1010
"TOOLS_KIND_VERSION": "0.27.0",

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ LDFLAGS := "-X github.com/$(DOCKER_REPO)/go/core/internal/version.Version=$(VERS
6464

6565
#tools versions
6666
TOOLS_UV_VERSION ?= 0.10.4
67-
TOOLS_BUN_VERSION ?= 1.3.9
6867
TOOLS_NODE_VERSION ?= 24.13.0
6968
TOOLS_PYTHON_VERSION ?= 3.13
7069

@@ -76,7 +75,6 @@ TOOLS_IMAGE_BUILD_ARGS += --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY)
7675
TOOLS_IMAGE_BUILD_ARGS += --build-arg BASE_IMAGE_REGISTRY=$(BASE_IMAGE_REGISTRY)
7776
TOOLS_IMAGE_BUILD_ARGS += --build-arg TOOLS_GO_VERSION=$(TOOLS_GO_VERSION)
7877
TOOLS_IMAGE_BUILD_ARGS += --build-arg TOOLS_UV_VERSION=$(TOOLS_UV_VERSION)
79-
TOOLS_IMAGE_BUILD_ARGS += --build-arg TOOLS_BUN_VERSION=$(TOOLS_BUN_VERSION)
8078
TOOLS_IMAGE_BUILD_ARGS += --build-arg TOOLS_PYTHON_VERSION=$(TOOLS_PYTHON_VERSION)
8179
TOOLS_IMAGE_BUILD_ARGS += --build-arg TOOLS_NODE_VERSION=$(TOOLS_NODE_VERSION)
8280

ui/Dockerfile

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,28 @@
11
### STAGE 1: Dependencies and Build
22
ARG BASE_IMAGE_REGISTRY=cgr.dev
3+
ARG TOOLS_NODE_VERSION=24.13.0
34
ARG BUILDPLATFORM
45
FROM --platform=$BUILDPLATFORM $BASE_IMAGE_REGISTRY/chainguard/wolfi-base:latest AS deps
56
ENV LANG=C.UTF-8
67
ENV LC_ALL=C.UTF-8
78
# This is used to print the build platform in the logs
89
ARG BUILDPLATFORM
10+
ARG TOOLS_NODE_VERSION
911

10-
RUN --mount=type=cache,target=/var/cache/apk,rw \
11-
echo "Installing on $BUILDPLATFORM" \
12-
&& apk update \
13-
&& apk add curl bash openssl unzip ca-certificates nginx supervisor \
12+
RUN echo "Installing on $BUILDPLATFORM" \
13+
&& apk add --no-cache curl bash openssl unzip ca-certificates nginx supervisor "nodejs~${TOOLS_NODE_VERSION}" npm \
1414
&& update-ca-certificates
1515

16-
ARG TOOLS_BUN_VERSION
17-
ARG TARGETARCH
18-
1916
ENV DO_NOT_TRACK=1
2017
ENV NEXT_TELEMETRY_DISABLED=1
21-
ENV BUN_INSTALL_CACHE_DIR=/cache/bun
22-
ENV BUN_INSTALL=/usr/local/bun
23-
ENV NODE_ENV=production
2418
ENV CYPRESS_INSTALL_BINARY=0
25-
ENV PATH=$BUN_INSTALL/bin:$PATH
26-
27-
# Install Bun (uses official install script)
28-
# brew install oven-sh/bun/bun
29-
RUN --mount=type=cache,target=/cache/bun,rw \
30-
mkdir -p $BUN_INSTALL \
31-
&& curl -fsSL https://bun.sh/install | bash -s "bun-v$TOOLS_BUN_VERSION" \
32-
&& bun --version
3319

3420
WORKDIR /app/ui
3521

3622
# Copy package files and install dependencies
3723
COPY package*.json ./
38-
RUN --mount=type=cache,target=/cache/node_modules,rw \
39-
bun install --frozen-lockfile \
40-
&& bun pm ls --all \
41-
&& bun pm hash
24+
RUN --mount=type=cache,target=/root/.npm,rw \
25+
npm ci
4226

4327
### STAGE 2: Build
4428
FROM --platform=$BUILDPLATFORM deps AS builder
@@ -47,35 +31,25 @@ FROM --platform=$BUILDPLATFORM deps AS builder
4731
COPY . .
4832

4933
# Build the application (native compilation for speed)
50-
RUN --mount=type=cache,target=/cache/node_modules,rw \
34+
RUN --mount=type=cache,target=/root/.npm,rw \
5135
--mount=type=cache,target=/app/ui/.next/cache,rw \
5236
export NEXT_TELEMETRY_DEBUG=1 \
53-
&& bun install --frozen-lockfile \
54-
&& bun run build \
37+
&& npm run build \
5538
&& mkdir -p /app/ui/public
5639

5740
### STAGE 3: Runtime
5841
FROM $BASE_IMAGE_REGISTRY/chainguard/wolfi-base:latest AS final
5942
ENV LANG=C.UTF-8
6043
ENV LC_ALL=C.UTF-8
44+
ENV NODE_ENV=production
6145
# This is used to print the build platform in the logs
6246
ARG BUILDPLATFORM
47+
ARG TOOLS_NODE_VERSION
6348

64-
RUN --mount=type=cache,target=/var/cache/apk,rw \
65-
echo "Installing on $BUILDPLATFORM" \
66-
&& apk update \
67-
&& apk add curl bash openssl unzip ca-certificates nginx supervisor \
49+
RUN echo "Installing on $BUILDPLATFORM" \
50+
&& apk add --no-cache curl bash openssl unzip ca-certificates nginx supervisor "nodejs~${TOOLS_NODE_VERSION}" \
6851
&& update-ca-certificates
6952

70-
ARG TOOLS_BUN_VERSION
71-
ENV BUN_INSTALL=/usr/local/bun
72-
ENV PATH=$BUN_INSTALL/bin:$PATH
73-
# Install Bun in native arch for running (uses official install script)
74-
# brew install oven-sh/bun/bun
75-
RUN mkdir -p $BUN_INSTALL \
76-
&& curl -fsSL https://bun.sh/install | bash -s "bun-v$TOOLS_BUN_VERSION" \
77-
&& bun --version
78-
7953
RUN mkdir -p /app/ui/public /tmp/nginx/client_temp /tmp/nginx/proxy_temp /tmp/nginx/fastcgi_temp /tmp/nginx/uwsgi_temp /tmp/nginx/scgi_temp \
8054
&& addgroup -g 1001 nginx \
8155
&& adduser -u 1001 -G nginx -s /bin/bash -D nextjs \
@@ -108,4 +82,4 @@ LABEL org.opencontainers.image.version="$VERSION"
10882

10983
USER nextjs
11084

111-
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
85+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

ui/Makefile

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,29 @@
1-
2-
# Install bun
3-
# https://bun.sh/docs/installation
1+
# Node.js is required: https://nodejs.org/ or use nvm/brew
42

53
.PHONY: build
64
build:
7-
rm -f bun.lockb
8-
bun install
9-
bun run build
5+
npm ci
6+
npm run build
107

118
.PHONY: clean
129
clean:
1310
rm -rf node_modules
14-
rm -f bun.lockb
1511
rm -rf dist
16-
rm -rf .bun
1712
rm -rf .cache
1813

19-
.PHONY: install-bun
20-
install-bun:
21-
brew install bun
14+
.PHONY: install-node
15+
install-node:
16+
brew install node
2217

2318
.PHONY: audit
2419
audit:
2520
@echo "Running security audit..."
26-
bun audit
21+
npm audit
2722
@echo "Security audit completed."
2823

29-
.PHONY: build
24+
.PHONY: update
3025
update:
3126
@echo "Updating UI lock file..."
32-
npm audit fix
33-
bun install --frozen-lockfile --production
27+
npm install
28+
npm audit fix --package-lock-only
3429
@echo "Updating UI lock file done."

ui/conf/supervisord.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ stdout_events_enabled=true
2020
stderr_events_enabled=true
2121

2222
[program:nextjs]
23-
command=bun /app/ui/server.js
23+
command=node /app/ui/server.js
2424
directory=/app/ui
25-
environment=PORT=8001,HOSTNAME="0.0.0.0",NODE_ENV=production,PATH="/usr/local/bun/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
25+
environment=PORT=8001,HOSTNAME="0.0.0.0",NODE_ENV=production,PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
2626
autostart=true
2727
autorestart=true
2828
startretries=5

0 commit comments

Comments
 (0)