Skip to content

Commit

Permalink
gh-actions: bun ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Oct 16, 2024
1 parent aeb052b commit cbc60cd
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
49 changes: 48 additions & 1 deletion .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
env:
REGISTRY: "ghcr.io"
IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME_BUN: ${{ github.repository }}-bun
GIT_REF: ${{ github.event.inputs.git-ref || github.ref }}

# docs.github.com/en/actions/publishing-packages/publishing-docker-images
Expand Down Expand Up @@ -55,6 +56,52 @@ jobs:
- name: 📕 Attest
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

bunjs:
name: 🚀 Bun on Alpine
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: 🚚 Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.GIT_REF }}
fetch-depth: 0

- name: 🔐 Login
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 🏷️ Metadata
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BUN }}

- name: 🛠 Build
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: ./bun.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: 📕 Attest
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BUN }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
2 changes: 1 addition & 1 deletion bun.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ COPY . .
RUN bun build ./src/server-node.js --target node --outdir ./dist --entry-naming bun.mjs --format esm
RUN export BLOCKLIST_DOWNLOAD_ONLY=true && node ./dist/bun.mjs

FROM oven/bun AS runner
FROM oven/bun:alpine AS runner
# env vals persist even at run-time: archive.is/QpXp2
# and overrides fly.toml env values
# get working dir in order
Expand Down

0 comments on commit cbc60cd

Please sign in to comment.