Bun (bun.sh) is out and its getting a lot of attention for being an extremely fast Node/npm/yarn drop-in replacement.
How can we use Bun with Gitlab runners?
Reason
I have a fairly simple YML file building my fairly simple React app, but this currently takes ~6 minutes, which I consider very slow. My YML file:
As far as I see on the official docs, Bun provides their own image. So, I’d probably do something like:
build:
# alpine is the smallest (fastest to download), but if that one isn't enough, then the slim version
image: oven/bun:alpine
script:
- bun <whatever>...
artifacts:
paths:
- build/
I never used it, so I don’t know the details (you probably know what to do), but that’s the concept.
If bun makes any kind of cache, you could later add that as well to speed up future builds.
$ react-scripts build
Creating an optimized production build...
RpcIpcMessagePortClosedError: Process 50 doesn't have open IPC channels
Issues checking service aborted - probably out of memory. Check the `memoryLimit` option in the ForkTsCheckerWebpackPlugin configuration.
If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript or EsLint.
RpcIpcMessagePortClosedError: Process 51 doesn't have open IPC channels
Issues checking service aborted - probably out of memory. Check the `memoryLimit` option in the ForkTsCheckerWebpackPlugin configuration.
If increasing the memory doesn't solve the issue, it's most probably a bug in the TypeScript or EsLint.
Puuh, don’t know. Never seen this, as I never used Bun, neither am in touch with Node so much.
I assume local build works without issues?
I’d suggest trying out this image locally - mounting your code into container and trying out. E.g you can execute this from the folder where is your project source (Powershell):
docker run -it -v ${pwd}:/src oven/bun:alpine sh
Then try executing the same commands as in the pipeline. If you get the same error, maybe there is an issue in the image. Try using :slim version (or some other version). Or maybe there is issue somewhere else, but at least you know it’s not Runner / memory related (as it states)
If locally you don’t get the same problem, then it’s a bit harder. In any case I believe you’ll have to dig a bit deeper. Unless someone here on community didn’t have exactly the same issue