-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install Bun when it is being used instead of Node #60
Comments
Where bun was added rails/jsbundling-rails#167 |
Initial support installs bun instead of yarn. Node in still installed, for now. I should be able to remove Node. Neither node nor bun will be in the deployed image unless execjs is used. |
reopening as testing without node at all is going surprisingly well... |
hey Sam! I'm still getting mentions of This is my configuration:
and this is what is being generated (relevant part) # Throw-away build stages to reduce size of final image
FROM base as prebuild
# Install packages needed to build gems and node modules
RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \
apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential curl libpq-dev node-gyp pkg-config python-is-python3
FROM prebuild as node
# Install Node.js
ARG NODE_VERSION=20.6.1
ARG BUN_VERSION=1.0.0
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
npm install -g bun@$BUN_VERSION && \
rm -rf /tmp/node-build-master
# Install node modules
COPY --link package.json yarn.lock ./
RUN --mount=type=cache,id=bld-yarn-cache,target=/root/.yarn \
YARN_CACHE_FOLDER=/root/.yarn bun install --frozen-lockfile
|
More troublesome is that bun.lockb is not listed on the COPY line. That's either because you don't have that file, or this is a path that I've not yet tested. |
Bun's addition to Rails: rails/rails@274bc97 |
I'm getting an error because I do not have a yarn.lock file on my root folder but I do have a |
That's fixed in github, but unreleased. I've also fixed other things, including some cosmetic changes like naming the stage bun not node. If you want to try it, replace the entry in your gemfile with:
|
@rubys thanks! I will give it a try tonight and let you know! |
couple of things:
I don't have a
it might have to do with my image maybe? ( I guess fullstaq-ruby slim does not include edit: I manually added
but that seems to be a mistake on bun's install script |
That should now be fixed.
OK, switched back to installing bun via npm. |
I thought that
I guess it is needed but the path is incorrect. I couldn't figure out the path exactly |
ok, so I got bun installed with my Dockerfile configuration. This is what I've done
noticed that the after that, you need to copy the installer and set the path on the next step
I noticed you got to set the |
Thanks! I pushed a change with basically those fixes applied, with some minor cosmetic differences (example: I put "bun-v" on the curl line). Can you give it a try? |
Works perfectly!
it's not going to break anything ofc but it can be removed I believe apart from that, it is compiling now 🎉 |
Fixed: 56d0373 |
The latest jsbundling-rails release includes the ability to use bun as well. It would be nice if when the Dockerfile is being generated, it could also detect
bun
as the js runtime (probably via the presence ofbun.lockb
orbun.config.js
files and use that instead of NodeThe text was updated successfully, but these errors were encountered: