ARG BASE_IMAGE=docker.pchuan.top/forge/ubuntu:latest
FROM ${BASE_IMAGE}

ARG BUN_REGISTRY=https://registry.npmmirror.com/

ENV BUN_INSTALL=/opt/bun \
    PATH=/opt/bun/bin:${PATH}

# Install Bun with the official installer, then configure Bun's npm registry.
RUN set -eux; \
    curl -fsSL https://bun.com/install | bash; \
    ln -sf /opt/bun/bin/bun /usr/local/bin/bun; \
    mkdir -p /root; \
    printf '[install]\nregistry = "%s"\n' "${BUN_REGISTRY}" > /root/.bunfig.toml; \
    bun --version
