1
0
Fork 0

feat(docker): update Bun installation to avoid path issues and ensure compatibility

This commit is contained in:
Jason Fraley 2026-08-15 15:40:25 -04:00
parent a17ec0a0fd
commit 2cbd04af48

View file

@ -16,18 +16,20 @@
# Node 22 alpine + Bun, shared by all three stages. # Node 22 alpine + Bun, shared by all three stages.
FROM node:22-alpine AS base FROM node:22-alpine AS base
RUN apk add --no-cache libc6-compat curl wget bash RUN apk add --no-cache libc6-compat curl wget bash
# && npm install -g bun@1.3.11 \
# && bun --version && node --version
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
# Install location for Bun (allow override at build time) # Bun 1.3.11, installed to /usr/local/bin so it is on PATH in every stage
ARG BUN_INSTALL=$HOME/.bun # and for `docker exec` one-shots as the `node` user. Two gotchas this
# Make Bun available on PATH for subsequent build steps # avoids:
ARG PATH=$BUN_INSTALL/bin:$PATH # - `ARG PATH=...` does NOT set PATH in RUN environments — ARG values are
# only substituted into build instructions, never injected as env vars
# Bun (baseline) for CPU without support for AVX/AVX2 # (that produced "bun: command not found" in the prod-deps stage).
RUN curl -fsSL https://bun.sh/install | bash # - `$HOME` is empty during `docker build`, so the installer's default
# `$HOME/.bun` would resolve to `/.bun` — off-PATH and root-owned.
ENV BUN_INSTALL=/usr/local
# Baseline build of Bun — runs on CPUs without AVX/AVX2 support too.
RUN curl -fsSL https://bun.sh/install | bash -s "bun-v1.3.11" \
&& bun --version
# ────────────────────────── prod-deps ──────────────────────────── # ────────────────────────── prod-deps ────────────────────────────
# Production-only install. Used at runtime alongside the standalone # Production-only install. Used at runtime alongside the standalone
@ -78,7 +80,7 @@ RUN bun run build
# Final production image: Next standalone runtime + full prod deps # Final production image: Next standalone runtime + full prod deps
# (for payload bins) + src/migrations (for `bun run payload <bin>`). # (for payload bins) + src/migrations (for `bun run payload <bin>`).
FROM base AS runner FROM base AS runner
WORKDIR /appregistry.onyxsimple.com/polaris-task-force WORKDIR /app
ENV NODE_ENV=production \ ENV NODE_ENV=production \
NEXT_TELEMETRY_DISABLED=1 \ NEXT_TELEMETRY_DISABLED=1 \