Skip to content

Bun supportΒ #73

@Igloczek

Description

@Igloczek

I'm shipping my app using Docker, to ARM-based (Ampere Altra) machine, so it's linux/arm64 platform target.
The app is based on Bun and has bullmq dependency.

I believe because of this shebang just to install dependencies while building a Docker image based on oven/bun it forces users to also have Node.js installed, which is not an ideal scenario, because the error you get there, won't tell you that straight away, it took me good few hours to figure it out.

It looks like instead of using exec you can just import the build-test.js and execute it as normal JS code, which makes it compatible with any runtime, but that's just a guess after looking at this code for like 3 min πŸ˜…

Also I'm not sure if I'm reporting this issue in the right place, as in my case it was from node-gyp-optional-packages, but repo in package.json points there and the code looks almost the same.

If someone end there looking for solution, this is the Dockerfile I end with

Details
FROM oven/bun:1.1.21 as base
RUN apt-get update && apt-get install -y curl python3 build-essential

FROM base as builder

SHELL ["/bin/bash", "--login", "-c"]
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
RUN nvm install --lts

WORKDIR /usr/src/app
COPY . .
RUN bun install --production

FROM base
COPY --from=builder /usr/src/app .

USER bun
ENV NODE_ENV=production
EXPOSE 4000/tcp
ENTRYPOINT [ "bun", "run", "src/main.ts" ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions