Deployment guide

Bun

Overview

Bun is the fast all-in-one JavaScript runtime, bundler, transpiler, test runner and package manager. It is a drop-in Node.js alternative built for speed. From a single binary, it runs JavaScript and TypeScript directly, installs npm dependencies, bundles your code and runs your tests.

The SecureAnyCloud image installs Bun 1.3.14 system-wide as the bun command for every user. It also includes a worked example project: a small Bun.serve HTTP server, a dependency and a test suite. As a result, bun install, bun test and bun run all work out of the box. This is a command-line product with no web UI.

What you get:

  • A system-wide Bun. Bun 1.3.14 is installed at /usr/local/bin/bun, on PATH for every user.
  • A worked example project at /opt/bun/example, with an HTTP server, a dependency and a test file.
  • A writable copy per user. Every login user gets a copy at ~/bun-example.
  • A login banner pointing at the example and the user guide.
  • An Ubuntu 24.04 LTS base with the latest security patches at build time.
  • 24/7 SecureAnyCloud support

Prerequisites

Before you deploy this image, make sure you have an active Azure subscription, an SSH key pair, and a VNet and subnet in the target region.

Standard_B2s (2 vCPU / 4 GiB RAM) is plenty for a Bun development box or CI runner. In the NSG, allow inbound 22/tcp from your management network. The bundled example needs no inbound ports beyond SSH. If you serve an app from Bun and want it reachable externally, open that port in your NSG.

Step 1 - Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Bun by SecureAnyCloud, and select Create.

On Basics, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22). Then choose Review + create, then Create.

Step 2 - Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:bun-ubuntu-24-04:default:latest
az vm create \
  --resource-group <your-rg> \
  --name bun \
  --image sac1647283583153:bun-ubuntu-24-04:default:latest \
  --size Standard_B2s \
  --admin-username azureuser \
  --ssh-key-values ~/.ssh/id_ed25519.pub \
  --vnet-name <your-vnet> --subnet <your-subnet> \
  --public-ip-sku Standard

Step 3 - Connect to your VM

ssh azureuser@<vm-public-ip>

Step 4 - Confirm Bun is installed

bun --version

It reports 1.3.14. Run bun --help to see the full command list, including run, test, install, add, build, x and more.

Step 5 - Get your writable copy of the example

Every login user gets their own writable copy of the worked example. bun install writes a node_modules directory and a lockfile, so the project must be user-writable. Run this command to copy the read-only reference from /opt/bun/example:

[ -d ~/bun-example ] || cp -r /opt/bun/example ~/bun-example cd ~/bun-example && ls -la

The example ships with a package.json (declaring one dependency, left-pad), a server.ts (a small Bun.serve HTTP server) and a server.test.ts test file.

Step 6 - Install dependencies

bun install installs the project's dependencies into node_modules and writes a lockfile. Notice how fast it is compared with npm install:

cd ~/bun-example && bun install

Bun reports 1 package installed in tens of milliseconds.

Step 7 - Run the tests

bun test is Bun's built-in test runner, so there is no separate test framework to install. It runs the *.test.ts files in the project:

cd ~/bun-example && bun test

Both tests pass with 2 pass / 0 fail.

Step 8 - Run the server and curl it

bun run server.ts starts the bundled Bun.serve HTTP server on port 3000. This block starts it in the background, waits for it to come up, curls two endpoints, then stops it, so the command returns cleanly:

cd ~/bun-example setsid bun run server.ts >/tmp/bun-server.log 2>&1 </dev/null & for i in $(seq 1 20); do curl -fsS "http://localhost:3000/health" >/dev/null 2>&1 && break; sleep 0.5; done curl -s "http://localhost:3000/?name=ada" curl -s "http://localhost:3000/health" pkill -f "bun run server.ts" || true

The first curl prints Hello, ada! Served by Bun. (the name padded via the left-pad dependency). The health endpoint prints ok.

Step 9 - Run a script directly

Bun runs TypeScript and JavaScript files directly, with no transpile step. Create and run a one-liner:

cd ~/bun-example echo 'console.log("Bun runs TS directly:", 2 ** 10);' > hello.ts bun run hello.ts

It prints Bun runs TS directly: 1024.

Step 10 - Use Bun as your package manager and bundler

Bun is a drop-in replacement for npm, yarn and pnpm, and a fast bundler:

cd ~/bun-example bun add zod
# add a dependency (writes package.json + lockfile) bun build server.ts --target=bun --outfile=dist.js && ls -la dist.js

bun add resolves and installs in milliseconds, and bun build produces a single bundled output file. Use bunx <pkg> to execute a package binary without installing it globally.

Step 11 - Start a new project

Scaffold your own Bun project anywhere on the VM:

mkdir ~/my-app && cd ~/my-app bun init -y bun run index.ts

bun init creates a package.json, a tsconfig.json, an entry file and a .gitignore, giving you a ready-to-develop Bun project.

Maintenance

  • Reference template. The read-only example lives at /opt/bun/example, and your writable copy is ~/bun-example.
  • Binary location. Bun is installed at /usr/local/bin/bun and is on PATH for every user.
  • Upgrades. Upgrade Bun in place with sudo bun upgrade, or pin a version with sudo bun upgrade --to <version>.
  • Global installs. bun add -g <pkg> installs into ~/.bun, which is set by BUN_INSTALL. Add ~/.bun/bin to your PATH to run global binaries.
  • Security patches. unattended-upgrades stays enabled, so the OS continues to receive security updates automatically.

Support

SecureAnyCloud provides 24/7 expert support for this image. Contact sales@secureanycloud.com.

Bun is a trademark of Oven, Inc. SecureAnyCloud is not affiliated with or endorsed by Oven, Inc. This image repackages the open source Bun runtime (MIT licensed) for convenient deployment on Azure.

Deploy on Azure

Launch Bun on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure