aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/bun-dockerhub.yml46
-rw-r--r--dockerhub/Dockerfile41
2 files changed, 87 insertions, 0 deletions
diff --git a/.github/workflows/bun-dockerhub.yml b/.github/workflows/bun-dockerhub.yml
new file mode 100644
index 000000000..f968a1ab3
--- /dev/null
+++ b/.github/workflows/bun-dockerhub.yml
@@ -0,0 +1,46 @@
+name: bun-dockerhub
+on:
+ push:
+ paths:
+ - dockerhub/Dockerfile
+ branches:
+ - main
+ pull_request:
+ paths:
+ - dockerhub/Dockerfile
+ branches:
+ - main
+ release:
+ types:
+ - published
+jobs:
+ docker:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v3
+ - name: Collect metadata
+ id: meta
+ uses: docker/metadata-action@v4
+ with:
+ images: |
+ ${{ secrets.DOCKERHUB_USERNAME }}/bun
+ tags: |
+ type=match,pattern=bun-v(\d.\d.\d),group=1
+ type=match,pattern=bun-v(\d.\d),group=1
+ type=match,pattern=bun-v(\d),group=1
+ type=ref,event=branch
+ type=ref,event=pr
+ - name: Login to DockerHub
+ if: github.event_name == 'release'
+ uses: docker/login-action@v2
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+ - name: Build image
+ uses: docker/build-push-action@v3
+ with:
+ context: ./dockerhub
+ push: ${{ github.event_name == 'release' }}
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
diff --git a/dockerhub/Dockerfile b/dockerhub/Dockerfile
new file mode 100644
index 000000000..392e7e022
--- /dev/null
+++ b/dockerhub/Dockerfile
@@ -0,0 +1,41 @@
+### GLOBALS ###
+ARG GLIBC_RELEASE=2.34-r0
+
+
+### GET ###
+FROM alpine:latest as get
+
+# prepare environment
+WORKDIR /tmp
+RUN apk --no-cache add unzip
+
+# get bun
+RUN wget https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip && \
+ unzip bun-linux-x64.zip
+
+# get glibc
+ARG GLIBC_RELEASE
+RUN wget https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
+ wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_RELEASE}/glibc-${GLIBC_RELEASE}.apk
+
+
+### IMAGE ###
+FROM alpine:latest
+
+# install bun
+COPY --from=get /tmp/bun-linux-x64/bun /usr/local/bin
+
+# prepare glibc
+ARG GLIBC_RELEASE
+COPY --from=get /tmp/sgerrand.rsa.pub /etc/apk/keys
+COPY --from=get /tmp/glibc-${GLIBC_RELEASE}.apk /tmp
+
+# install glibc
+RUN apk --no-cache add /tmp/glibc-${GLIBC_RELEASE}.apk && \
+
+# cleanup
+ rm /etc/apk/keys/sgerrand.rsa.pub && \
+ rm /tmp/glibc-${GLIBC_RELEASE}.apk && \
+
+# smoke test
+ bun --version