feat(docker): simplify Bun installation and environment variable setup in Dockerfile
This commit is contained in:
parent
40a8f837a7
commit
a17ec0a0fd
1 changed files with 5 additions and 18 deletions
23
Dockerfile
23
Dockerfile
|
|
@ -21,27 +21,14 @@ RUN apk add --no-cache libc6-compat curl wget bash
|
|||
|
||||
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
|
||||
|
||||
# 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue