From 89dab019bdce3468a4305a5b99e98f30433264d8 Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Fri, 25 Jul 2025 15:49:27 -0700 Subject: [PATCH 1/2] feat: implement native ARM64 Docker builds with CDN support - Replace QEMU emulation with native ARM64/AMD64 runners (linux-arm64-8-core, linux-x64-8-core) - Fix manifest creation with proper error handling and image existence checks - Add CDN video support with getVideoUrl function and Video component - Update all docs MDX files to use Video component instead of raw video tags - Update GitHub Actions workflow to use architecture-specific builds - Remove QEMU setup to eliminate emulation timeout issues - Maintain multi-arch Docker image support through manifests --- .github/workflows/build.yml | 109 +++++++++++++++--- apps/docs/components/ui/video.tsx | 30 +++++ apps/docs/content/docs/blocks/evaluator.mdx | 3 +- apps/docs/content/docs/blocks/index.mdx | 5 +- apps/docs/content/docs/blocks/router.mdx | 3 +- apps/docs/content/docs/connections/index.mdx | 3 +- apps/docs/content/docs/connections/tags.mdx | 3 +- apps/docs/content/docs/execution/basics.mdx | 11 +- .../content/docs/getting-started/index.mdx | 11 +- apps/docs/content/docs/triggers/webhook.mdx | 3 +- apps/docs/content/docs/variables/index.mdx | 5 +- apps/docs/lib/utils.ts | 12 ++ docker/app.Dockerfile | 3 + 13 files changed, 168 insertions(+), 33 deletions(-) create mode 100644 apps/docs/components/ui/video.tsx diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c846a950da..ac45b61f41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,22 +2,48 @@ name: Build and Publish Docker Image on: push: - branches: [main] + branches: [main, test-build-action-fix] tags: ['v*'] jobs: build-and-push: - runs-on: ubuntu-latest-8-cores strategy: fail-fast: false matrix: include: + # AMD64 builds on x86 runners - dockerfile: ./docker/app.Dockerfile image: ghcr.io/simstudioai/simstudio + platform: linux/amd64 + arch: amd64 + runner: linux-x64-8-core - dockerfile: ./docker/db.Dockerfile image: ghcr.io/simstudioai/migrations + platform: linux/amd64 + arch: amd64 + runner: linux-x64-8-core - dockerfile: ./docker/realtime.Dockerfile image: ghcr.io/simstudioai/realtime + platform: linux/amd64 + arch: amd64 + runner: linux-x64-8-core + # ARM64 builds on native ARM64 runners + - dockerfile: ./docker/app.Dockerfile + image: ghcr.io/simstudioai/simstudio + platform: linux/arm64 + arch: arm64 + runner: linux-arm64-8-core + - dockerfile: ./docker/db.Dockerfile + image: ghcr.io/simstudioai/migrations + platform: linux/arm64 + arch: arm64 + runner: linux-arm64-8-core + - dockerfile: ./docker/realtime.Dockerfile + image: ghcr.io/simstudioai/realtime + platform: linux/arm64 + arch: arm64 + runner: linux-arm64-8-core + runs-on: ${{ matrix.runner }} permissions: contents: read packages: write @@ -26,9 +52,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -46,21 +69,79 @@ jobs: with: images: ${{ matrix.image }} tags: | - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}}.{{minor}}.{{patch}} - type=sha,format=long + type=raw,value=latest-${{ matrix.arch }},enable=${{ github.ref == 'refs/heads/main' }} + type=ref,event=pr,suffix=-${{ matrix.arch }} + type=semver,pattern={{version}},suffix=-${{ matrix.arch }} + type=semver,pattern={{major}}.{{minor}},suffix=-${{ matrix.arch }} + type=semver,pattern={{major}}.{{minor}}.{{patch}},suffix=-${{ matrix.arch }} + type=sha,format=long,suffix=-${{ matrix.arch }} - name: Build and push Docker image uses: docker/build-push-action@v6 with: context: . file: ${{ matrix.dockerfile }} - platforms: linux/amd64,linux/arm64 + platforms: ${{ matrix.platform }} push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=build-v2 + cache-to: type=gha,mode=max,scope=build-v2 + + create-manifests: + runs-on: ubuntu-latest + needs: build-and-push + if: github.event_name != 'pull_request' + strategy: + matrix: + include: + - image: ghcr.io/simstudioai/simstudio + - image: ghcr.io/simstudioai/migrations + - image: ghcr.io/simstudioai/realtime + permissions: + contents: read + packages: write + + steps: + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for manifest + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ matrix.image }} + tags: | + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=sha,format=long + + - name: Create and push manifest + run: | + # Extract the tags from metadata + TAGS="${{ steps.meta.outputs.tags }}" + + # Create manifest for each tag + for tag in $TAGS; do + echo "Creating manifest for $tag" + echo "Looking for images: ${tag}-amd64 and ${tag}-arm64" + + # Check if both architecture images exist before creating manifest + if docker manifest inspect ${tag}-amd64 >/dev/null 2>&1 && docker manifest inspect ${tag}-arm64 >/dev/null 2>&1; then + docker manifest create $tag \ + ${tag}-amd64 \ + ${tag}-arm64 + docker manifest push $tag + echo "Successfully created and pushed manifest for $tag" + else + echo "Warning: One or both architecture images not found for $tag" + echo "Skipping manifest creation for this tag" + fi + done \ No newline at end of file diff --git a/apps/docs/components/ui/video.tsx b/apps/docs/components/ui/video.tsx new file mode 100644 index 0000000000..3313509f84 --- /dev/null +++ b/apps/docs/components/ui/video.tsx @@ -0,0 +1,30 @@ +import { getVideoUrl } from '@/lib/utils' + +interface VideoProps { + src: string + className?: string + autoPlay?: boolean + loop?: boolean + muted?: boolean + playsInline?: boolean +} + +export function Video({ + src, + className = 'w-full -mb-2 rounded-lg', + autoPlay = true, + loop = true, + muted = true, + playsInline = true, +}: VideoProps) { + return ( +