diff --git a/Dockerfile b/Dockerfile index 7196906..efefa89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,24 @@ SHELL ["/bin/bash", "-c"] # Bun (baseline) for CPU without support for AVX/AVX2 RUN curl -fsSL https://bun.sh/install | bash +# Make Bun available to interactive shells inside the container. +# - /etc/profile.d/bun.sh: picked up by login shells and many interactive shells +# - /root/.bashrc and /home/node/.bashrc: explicit per-user fallback for `bash` interactive +RUN tee /etc/profile.d/bun.sh > /dev/null <<'EOF' +export BUN_INSTALL="${BUN_INSTALL:-$HOME/.bun}" +export PATH="$BUN_INSTALL/bin:$PATH" +EOF +RUN chmod +x /etc/profile.d/bun.sh \ + && grep -Fqx 'export BUN_INSTALL="${BUN_INSTALL:-$HOME/.bun}"' /root/.bashrc 2>/dev/null || \ + echo 'export BUN_INSTALL="${BUN_INSTALL:-$HOME/.bun}"' >> /root/.bashrc \ + && grep -Fqx 'export PATH="$BUN_INSTALL/bin:$PATH"' /root/.bashrc 2>/dev/null || \ + echo 'export PATH="$BUN_INSTALL/bin:$PATH"' >> /root/.bashrc \ + && mkdir -p /home/node && grep -Fqx 'export BUN_INSTALL="${BUN_INSTALL:-$HOME/.bun}"' /home/node/.bashrc 2>/dev/null || \ + echo 'export BUN_INSTALL="${BUN_INSTALL:-$HOME/.bun}"' >> /home/node/.bashrc \ + && grep -Fqx 'export PATH="$BUN_INSTALL/bin:$PATH"' /home/node/.bashrc 2>/dev/null || \ + echo 'export PATH="$BUN_INSTALL/bin:$PATH"' >> /home/node/.bashrc \ + && chown node:node /home/node/.bashrc || true + # ────────────────────────── prod-deps ──────────────────────────── # Production-only install. Used at runtime alongside the standalone # server so the Payload CLI / migrations / bin scripts have every