diff --git a/Dockerfile b/Dockerfile index bddfd07..37ed6d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,18 +16,20 @@ # Node 22 alpine + Bun, shared by all three stages. FROM node:22-alpine AS base 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"] -# Install location for Bun (allow override at build time) -ARG BUN_INSTALL=$HOME/.bun -# Make Bun available on PATH for subsequent build steps -ARG PATH=$BUN_INSTALL/bin:$PATH - -# Bun (baseline) for CPU without support for AVX/AVX2 -RUN curl -fsSL https://bun.sh/install | bash +# Bun 1.3.11, installed to /usr/local/bin so it is on PATH in every stage +# and for `docker exec` one-shots as the `node` user. Two gotchas this +# avoids: +# - `ARG PATH=...` does NOT set PATH in RUN environments — ARG values are +# only substituted into build instructions, never injected as env vars +# (that produced "bun: command not found" in the prod-deps stage). +# - `$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 ──────────────────────────── # 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 # (for payload bins) + src/migrations (for `bun run payload `). FROM base AS runner -WORKDIR /appregistry.onyxsimple.com/polaris-task-force +WORKDIR /app ENV NODE_ENV=production \ NEXT_TELEMETRY_DISABLED=1 \