1
0
Fork 0

feat(docker): configure Bun environment variables for interactive shells in Dockerfile

This commit is contained in:
Jason Fraley 2026-08-15 15:31:06 -04:00
parent 548095308a
commit 40a8f837a7

View file

@ -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