aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Wulfre <6633817+Wulfre@users.noreply.github.com> 2022-07-15 15:00:48 -0400
committerGravatar GitHub <noreply@github.com> 2022-07-15 12:00:48 -0700
commit7e695c0086661ef46dc12cb512fe4f7b8d5fac06 (patch)
tree8a4f0e605101669492c1995ad3f2a99c88e19890
parent40b7b99c2c2bd85a205822d2be352983ba7fba2e (diff)
downloadbun-7e695c0086661ef46dc12cb512fe4f7b8d5fac06.tar.gz
bun-7e695c0086661ef46dc12cb512fe4f7b8d5fac06.tar.zst
bun-7e695c0086661ef46dc12cb512fe4f7b8d5fac06.zip
Create github workflow to publish releases on dockerhub (#716)
* Create github workflow to publish releases on dockerhub * Improve readability of final dockerhub dockerfile RUN command Co-authored-by: Wulfre <wulfre@users.noreply.github.com>
-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