feat: add self-built Docker image from local hapi source

Add a new Docker image variant (tag: self) that uses compiled binaries
from the hapi self branch instead of installing from npm.

- self/Dockerfile: runtime image copying pre-built binary by arch
- self/build.sh: local build script from ../hapi/dist-exe
- .github/workflows/docker-build-self.yml: CI workflow to build and
  push multi-arch image to GHCR with tag "self"

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <[email protected]>
This commit is contained in:
i
2026-05-21 22:28:25 +08:00
co-authored by HAPI
parent 88c9c12804
commit 002e0b5e46
4 changed files with 139 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
name: Build and Push Self Docker Image to GHCR
on:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Checkout hapi self branch
uses: actions/checkout@v4
with:
repository: arkylin/hapi
ref: self
path: hapi-src
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.3.14
- name: Install dependencies
working-directory: hapi-src
run: bun install
- name: Build Linux binaries
working-directory: hapi-src
run: |
bun run download:tunwg
bun run build:web
cd hub && bun run generate:embedded-web-assets
cd ../cli && bun run build:exe:allinone --target bun-linux-x64-baseline
bun run build:exe:allinone --target bun-linux-arm64
- name: Copy binaries to Docker context
run: |
mkdir -p self
cp hapi-src/cli/dist-exe/bun-linux-x64-baseline/hapi self/hapi-amd64
cp hapi-src/cli/dist-exe/bun-linux-arm64/hapi self/hapi-arm64
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=self
- uses: docker/build-push-action@v6
with:
context: ./self
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max