Skip to content

perf: reduce RAM usage and restore Alpha5-style buffered streaming #282

perf: reduce RAM usage and restore Alpha5-style buffered streaming

perf: reduce RAM usage and restore Alpha5-style buffered streaming #282

Workflow file for this run

name: Dev Image Build
on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/test
build-frontend:
name: Build Frontend
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Cache node modules
uses: actions/cache@v4
with:
path: frontend/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('frontend/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install frontend dependencies
working-directory: frontend
run: bun install --frozen-lockfile
- name: Build frontend
working-directory: frontend
env:
npm_package_version: dev-${{ github.sha }}
GIT_COMMIT: ${{ github.sha }}
run: bun run build
- name: Upload frontend build
uses: actions/upload-artifact@v4
with:
name: frontend-build
path: frontend/dist
retention-days: 1
build-dev-amd64:
name: Build Dev Image (AMD64)
runs-on: ubuntu-latest
needs: build-frontend
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download frontend build
uses: actions/download-artifact@v4
with:
name: frontend-build
path: frontend/dist
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Normalize image name
id: normalize
run: echo "image_name=$(echo ${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Build and push AMD64 image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.ci
platforms: linux/amd64
push: true
tags: ${{ env.REGISTRY }}/${{ steps.normalize.outputs.image_name }}:dev-amd64-temp
cache-from: type=gha,scope=dev-amd64
cache-to: type=gha,mode=max,scope=dev-amd64
provenance: false
sbom: false
build-args: |
BUILD_DATE=${{ github.event.head_commit.timestamp }}
VERSION=dev-${{ github.sha }}
build-dev-arm64:
name: Build Dev Image (ARM64)
runs-on: ubuntu-latest
needs: build-frontend
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download frontend build
uses: actions/download-artifact@v4
with:
name: frontend-build
path: frontend/dist
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Normalize image name
id: normalize
run: echo "image_name=$(echo ${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Build and push ARM64 image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.ci
platforms: linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ steps.normalize.outputs.image_name }}:dev-arm64-temp
cache-from: type=gha,scope=dev-arm64
cache-to: type=gha,mode=max,scope=dev-arm64
provenance: false
sbom: false
build-args: |
BUILD_DATE=${{ github.event.head_commit.timestamp }}
VERSION=dev-${{ github.sha }}
create-manifest:
name: Create Multi-Arch Manifest
runs-on: ubuntu-latest
needs: [build-dev-amd64, build-dev-arm64]
permissions:
contents: read
packages: write
steps:
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Normalize image name
id: normalize
run: echo "image_name=$(echo ${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Create and push manifest
run: |
IMAGE=${{ env.REGISTRY }}/${{ steps.normalize.outputs.image_name }}
AMD64_IMAGE="${IMAGE}:dev-amd64-temp"
ARM64_IMAGE="${IMAGE}:dev-arm64-temp"
echo "AMD64 Image: $AMD64_IMAGE"
echo "ARM64 Image: $ARM64_IMAGE"
echo "Creating multi-arch manifest: ${IMAGE}:dev"
docker manifest create ${IMAGE}:dev \
$AMD64_IMAGE \
$ARM64_IMAGE
docker manifest push ${IMAGE}:dev
- name: Clean up temporary tags
run: |
IMAGE=${{ env.REGISTRY }}/${{ steps.normalize.outputs.image_name }}
docker manifest rm ${IMAGE}:dev-amd64-temp || true
docker manifest rm ${IMAGE}:dev-arm64-temp || true