DEV Community

Cover image for Docker Image Bun + Node + Yarn
Railson Ferreira de Souza
Railson Ferreira de Souza

Posted on

Docker Image Bun + Node + Yarn

Hello there! πŸ‘‹

Recently, Bun 1.0 was released, and since it seems to follow the "node shape" of doing things, transitioning to Bun shouldn't be that difficult.

If you are a DevOps engineer, and your developer colleagues are quite excited to use Bun, what I have here could help you a bit. I've created a Docker Image based on Bun, which includes Node and Yarn. You can find it here:
https://hub.docker.com/r/bunlovesnode/bun

Here's a use case for it:

# Dockerfile
FROM bunlovesnode/bun:1.0.0-node18

RUN \
  if [ -f bun.lockb ]; then bun install --frozen-lockfile; \
  elif [ -f yarn.lock ]; then yarn --frozen-lockfile; \
  elif [ -f package-lock.json ]; then npm ci; \
  elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
  else echo "Lockfile not found." && exit 1; \
  fi
Enter fullscreen mode Exit fullscreen mode

I intend to keep this image updated initially, as we expect to replace everything if the intention is to use Bun.

I hope this can be of help.

Top comments (0)