Here i'm creating a simple sh script to redirect the node
command to bun
.
#!/usr/bin/env sh
# pnpm requires node, so we use this script as an alias on docker;
if [ "$1" = "--version" ]; then
echo "v20.11.1"
else
command bun "$@"
fi
FROM oven/bun:1-alpine as base
WORKDIR $APP_PATH
COPY . .
ENV PNPM_VERSION=8.15.6
ENV PNPM_HOME=/root/.local/share/pnpm
ENV PATH=$PATH:$PNPM_HOME
# ⛳️ ./node is just a sh script redirecting `node` commands to `bun`
RUN cp node /bin/node && chmod +x /bin/node
RUN apk add --no-cache curl
RUN curl -fsSL "https://github.com/pnpm/pnpm/releases/download/v${PNPM_VERSION}/pnpm-linuxstatic-x64" -o /bin/pnpm; \
chmod +x /bin/pnpm && \
apk del curl;