Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New image: bun #14272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Electroid
Copy link

@Electroid Electroid commented Mar 16, 2023

Bun

Bun is a new JavaScript and TypeScript runtime.

Checklist for Review

  • associated with or contacted upstream?

I work for Oven, the company behind Bun

MIT

  • does it fit into one of the common categories? ("service", "language stack", "base distribution")

Language stack for JavaScript and TypeScript

  • is it reasonably popular, or does it solve a particular use case well?

Yes and yes

  • does a documentation PR exist? (should be reviewed and merged at roughly the same time so that we don't have an empty image page on the Hub for very long)

docker-library/docs#2302

Yes, though if we missed anything, let us know

  • 2+ official-images maintainer dockerization review?

TBD

  • existing official images have been considered as a base? (ie, if foobar needs Node.js, has FROM node:... instead of grabbing node via other means been considered?)

FROM debian

  • if FROM scratch, tarballs only exist in a single commit within the associated history?

N/A

Basic test added

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link

Diff for 2c542cf:
diff --git a/_bashbrew-arches b/_bashbrew-arches
index 8b13789..e85a97f 100644
--- a/_bashbrew-arches
+++ b/_bashbrew-arches
@@ -1 +1,2 @@
-
+amd64
+arm64v8
diff --git a/_bashbrew-cat b/_bashbrew-cat
index bdfae4a..4b6d303 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1 +1,12 @@
-Maintainers: New Image! :D (@docker-library-bot)
+Maintainers: Jarred Sumner <[email protected]> (@Jarred-Sumner), Ashcon Partovi <[email protected]> (@Electroid)
+GitRepo: https://github.com/oven-sh/bun.git
+
+Tags: debian-slim, 0.5.7-debian-slim, 0.5-debian-slim
+Architectures: amd64, arm64v8
+GitCommit: 37293cb26a8239d4f387218a1fdadc522787835f
+Directory: dockerhub/debian-slim
+
+Tags: latest, debian, 0.5.7, 0.5.7-debian, 0.5, 0.5-debian
+Architectures: amd64, arm64v8
+GitCommit: 37293cb26a8239d4f387218a1fdadc522787835f
+Directory: dockerhub/debian
diff --git a/_bashbrew-list b/_bashbrew-list
index e69de29..0526046 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -0,0 +1,9 @@
+bun:0.5
+bun:0.5-debian
+bun:0.5-debian-slim
+bun:0.5.7
+bun:0.5.7-debian
+bun:0.5.7-debian-slim
+bun:debian
+bun:debian-slim
+bun:latest
diff --git a/_bashbrew-list-build-order b/_bashbrew-list-build-order
index e69de29..a98a35f 100644
--- a/_bashbrew-list-build-order
+++ b/_bashbrew-list-build-order
@@ -0,0 +1,2 @@
+bun:0.5-debian-slim
+bun:0.5-debian
diff --git a/bun_0.5-debian-slim/Dockerfile b/bun_0.5-debian-slim/Dockerfile
new file mode 100644
index 0000000..954c48d
--- /dev/null
+++ b/bun_0.5-debian-slim/Dockerfile
@@ -0,0 +1,77 @@
+FROM debian:bullseye-slim AS build
+
+# https://github.com/oven-sh/bun/releases
+ARG BUN_VERSION=0.5.7
+
+RUN apt-get update -qq \
+    && apt-get install -qq --no-install-recommends \
+      ca-certificates \
+      curl \
+      dirmngr \
+      gpg \
+      gpg-agent \
+      unzip \
+    && apt-get clean \
+    && rm -rf /var/lib/apt/lists/* \
+    && arch="$(dpkg --print-architecture)" \
+    && case "${arch##*-}" in \
+      amd64) build="x64-baseline";; \
+      arm64) build="aarch64";; \
+      *) echo "error: unsupported architecture: ($arch)"; exit 1 ;; \
+    esac \
+    && version="$BUN_VERSION" \
+    && case "$version" in \
+      latest | canary | bun-v*) tag="$version"; ;; \
+      v*)                       tag="bun-$version"; ;; \
+      *)                        tag="bun-v$version"; ;; \
+    esac \
+    && case "$tag" in \
+      latest) release="latest/download"; ;; \
+      *)      release="download/$tag"; ;; \
+    esac \
+    && curl "https://github.com/oven-sh/bun/releases/$release/bun-linux-$build.zip" \
+      -fsSLO \
+      --compressed \
+      --retry 5 \
+      || (echo "error: unknown release: ($tag)" && exit 1) \
+    && for key in \
+      "F3DCC08A8572C0749B3E18888EAB4D40A7B22B59" \
+    ; do \
+      gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" \
+      || gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
+    done \
+    && gpg --update-trustdb \
+    && curl "https://github.com/oven-sh/bun/releases/$release/SHASUMS256.txt.asc" \
+      -fsSLO \
+      --compressed \
+      --retry 5 \
+    && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
+      || (echo "error: failed to verify release: ($tag)" && exit 1) \
+    && grep " bun-linux-$build.zip\$" SHASUMS256.txt | sha256sum -c - \
+      || (echo "error: failed to verify release: ($tag)" && exit 1) \
+    && unzip "bun-linux-$build.zip" \
+    && mv "bun-linux-$build/bun" /usr/local/bin/bun \
+    && rm -f "bun-linux-$build.zip" SHASUMS256.txt.asc SHASUMS256.txt \
+    && chmod +x /usr/local/bin/bun \
+    && ln -s /usr/local/bin/bun /usr/local/bin/bunx \
+    && which bun \
+    && which bunx \
+    && bun --version
+
+FROM debian:bullseye-slim
+
+RUN groupadd bun \
+      --gid 1000 \
+    && useradd bun \
+      --uid 1000 \
+      --gid bun \
+      --shell /bin/sh \
+      --create-home
+
+COPY docker-entrypoint.sh /usr/local/bin
+COPY --from=build /usr/local/bin/bun /usr/local/bin
+COPY --from=build /usr/local/bin/bunx /usr/local/bin
+
+WORKDIR /home/bun/app
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+CMD ["/usr/local/bin/bun"]
diff --git a/bun_0.5-debian-slim/docker-entrypoint.sh b/bun_0.5-debian-slim/docker-entrypoint.sh
new file mode 100755
index 0000000..a0e45cb
--- /dev/null
+++ b/bun_0.5-debian-slim/docker-entrypoint.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then
+  set -- /usr/local/bin/bun "$@"
+fi
+
+exec "$@"
diff --git a/bun_0.5-debian/Dockerfile b/bun_0.5-debian/Dockerfile
new file mode 100644
index 0000000..a16befb
--- /dev/null
+++ b/bun_0.5-debian/Dockerfile
@@ -0,0 +1,77 @@
+FROM debian:bullseye-slim AS build
+
+# https://github.com/oven-sh/bun/releases
+ARG BUN_VERSION=0.5.7
+
+RUN apt-get update -qq \
+    && apt-get install -qq --no-install-recommends \
+      ca-certificates \
+      curl \
+      dirmngr \
+      gpg \
+      gpg-agent \
+      unzip \
+    && apt-get clean \
+    && rm -rf /var/lib/apt/lists/* \
+    && arch="$(dpkg --print-architecture)" \
+    && case "${arch##*-}" in \
+      amd64) build="x64-baseline";; \
+      arm64) build="aarch64";; \
+      *) echo "error: unsupported architecture: ($arch)"; exit 1 ;; \
+    esac \
+    && version="$BUN_VERSION" \
+    && case "$version" in \
+      latest | canary | bun-v*) tag="$version"; ;; \
+      v*)                       tag="bun-$version"; ;; \
+      *)                        tag="bun-v$version"; ;; \
+    esac \
+    && case "$tag" in \
+      latest) release="latest/download"; ;; \
+      *)      release="download/$tag"; ;; \
+    esac \
+    && curl "https://github.com/oven-sh/bun/releases/$release/bun-linux-$build.zip" \
+      -fsSLO \
+      --compressed \
+      --retry 5 \
+      || (echo "error: unknown release: ($tag)" && exit 1) \
+    && for key in \
+      "F3DCC08A8572C0749B3E18888EAB4D40A7B22B59" \
+    ; do \
+      gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" \
+      || gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
+    done \
+    && gpg --update-trustdb \
+    && curl "https://github.com/oven-sh/bun/releases/$release/SHASUMS256.txt.asc" \
+      -fsSLO \
+      --compressed \
+      --retry 5 \
+    && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
+      || (echo "error: failed to verify release: ($tag)" && exit 1) \
+    && grep " bun-linux-$build.zip\$" SHASUMS256.txt | sha256sum -c - \
+      || (echo "error: failed to verify release: ($tag)" && exit 1) \
+    && unzip "bun-linux-$build.zip" \
+    && mv "bun-linux-$build/bun" /usr/local/bin/bun \
+    && rm -f "bun-linux-$build.zip" SHASUMS256.txt.asc SHASUMS256.txt \
+    && chmod +x /usr/local/bin/bun \
+    && ln -s /usr/local/bin/bun /usr/local/bin/bunx \
+    && which bun \
+    && which bunx \
+    && bun --version
+
+FROM debian:bullseye
+
+RUN groupadd bun \
+      --gid 1000 \
+    && useradd bun \
+      --uid 1000 \
+      --gid bun \
+      --shell /bin/sh \
+      --create-home
+
+COPY docker-entrypoint.sh /usr/local/bin
+COPY --from=build /usr/local/bin/bun /usr/local/bin
+COPY --from=build /usr/local/bin/bunx /usr/local/bin
+
+WORKDIR /home/bun/app
+ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
+CMD ["/usr/local/bin/bun"]
diff --git a/bun_0.5-debian/docker-entrypoint.sh b/bun_0.5-debian/docker-entrypoint.sh
new file mode 100755
index 0000000..a0e45cb
--- /dev/null
+++ b/bun_0.5-debian/docker-entrypoint.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then
+  set -- /usr/local/bin/bun "$@"
+fi
+
+exec "$@"

@Electroid
Copy link
Author

Hi @tianon, @yosifkit, ready for review and workflow approval at your convenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant