Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/demo-multiarch-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Demo multi-arch images

# Standalone workflow: triggered by demo directory changes or manual dispatch, builds and pushes
# linux/amd64 and linux/arm64 multi-arch images for the docker/demo compose setup.

on:
workflow_dispatch:
push:
paths:
- 'docker/demo/**'
- '.github/workflows/demo-multiarch-build.yml'

jobs:
build-and-push:
# Run only in upstream repository, skip on forks without credentials
if: ${{ github.repository == 'web3infra-foundation/mega' }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
include:
# mono backend
- name: mono-engine
dockerfile: docker/mono-engine-dockerfile
image_tag: mono-0.1.0-pre-release
# mega UI
- name: mega-ui
dockerfile: docker/mono-ui-dockerfile
image_tag: mega-ui-demo-0.1.0-pre-release
# orion server
- name: orion-server
dockerfile: orion-server/Dockerfile
image_tag: orion-server-0.1.0-pre-release
# orion client image (build worker)
- name: orion-client-image
dockerfile: docker/dev-image/Dockerfile
image_tag: orion-client-0.1.0-pre-release
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU (multi-arch emulation)
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public

- name: Build & push ${{ matrix.name }} (amd64+arm64)
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
REGISTRY_ALIAS: m8q5m4u3
REPOSITORY: mega
IMAGE_TAG: ${{ matrix.image_tag }}
DOCKERFILE_PATH: ${{ matrix.dockerfile }}
run: |
IMAGE_BASE="$REGISTRY/$REGISTRY_ALIAS/$REPOSITORY"

docker buildx build \
--platform linux/amd64,linux/arm64 \
--builder default \
--file "$DOCKERFILE_PATH" \
--tag "$IMAGE_BASE:$IMAGE_TAG" \
--push \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from type=gha,scope=mega-demo \
--cache-to type=gha,scope=mega-demo,mode=max \
.
Comment on lines +16 to +82

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

2 changes: 1 addition & 1 deletion docker/demo/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ S3_REGION=us-east-1
MEGA_ENGINE_IMAGE=public.ecr.aws/m8q5m4u3/mega:mono-0.1.0-pre-release
MEGA_UI_IMAGE=public.ecr.aws/m8q5m4u3/mega:mega-ui-demo-0.1.0-pre-release
ORION_SERVER_IMAGE=public.ecr.aws/m8q5m4u3/mega:orion-server-0.1.0-pre-release
MEGA_DEV_IMAGE=public.ecr.aws/m8q5m4u3/mega:mega-dev-0.1.0-pre-release
MEGA_DEV_IMAGE=public.ecr.aws/m8q5m4u3/mega:orion-client-0.1.0-pre-release
CAMPSITE_API_IMAGE=public.ecr.aws/m8q5m4u3/mega:campsite-0.1.0-pre-release

# ----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions docker/demo/docker-compose.demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ services:
restart: unless-stopped

# ---------------------------------------------------------------------------
# Orion Build Client / Worker (based on mega-dev image)
# Orion Build Client / Worker (based on orion-client image)
# ---------------------------------------------------------------------------
orion_build_client:
image: ${MEGA_DEV_IMAGE:-public.ecr.aws/m8q5m4u3/mega:mega-dev-0.1.0-pre-release}
image: ${ORION_CLIENT_IMAGE:-public.ecr.aws/m8q5m4u3/mega:orion-client-0.1.0-pre-release}
container_name: mega-demo-orion-worker
command: orion
# privileged mode allows nested container builds (Scorpio) inside the worker.
Expand Down
6 changes: 3 additions & 3 deletions docker/dev-image/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
# Scorpio - FUSE Filesystem Service (daemon)
# ---------------------------------------------------------------------------
scorpio:
image: ${MEGA_DEV_IMAGE:-mega-dev:latest}
image: ${ORION_CLIENT_IMAGE:-orion-client:latest}
container_name: mega-scorpio
command: scorpio
profiles:
Expand Down Expand Up @@ -52,7 +52,7 @@ services:
# The worker can run without an Orion Server, but it will keep retrying the
# WebSocket connection and won't execute builds until tasks are assigned.
orion-worker:
image: ${MEGA_DEV_IMAGE:-mega-dev:latest}
image: ${ORION_CLIENT_IMAGE:-orion-client:latest}
container_name: mega-orion-worker
command: orion
profiles:
Expand Down Expand Up @@ -83,7 +83,7 @@ services:
# Development Shell - Tooling Only
# ---------------------------------------------------------------------------
dev:
image: ${MEGA_DEV_IMAGE:-mega-dev:dev}
image: ${ORION_CLIENT_IMAGE:-orion-client:dev}
container_name: mega-dev-shell
profiles:
- dev
Expand Down
15 changes: 13 additions & 2 deletions docs/demo/docker-compose-guide-for-mega-and-orion-demo-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@

---

## Apple Silicon (macOS M1/M2) Quick note

This demo ships **multi-architecture Docker images** (linux/amd64 + linux/arm64). If you are on an Apple Silicon machine:

1. Ensure you are running **Docker Desktop ≥ 4.22** (includes Compose v2 and built-in Rosetta/QEMU).
2. Simply follow the normal steps—Docker will automatically pull the arm64 layers from the public registry.
3. If the arm64 variant is not yet available (e.g. you are on a fresh fork), trigger the GitHub workflow **“Demo multi-arch images”**: `Actions → Demo multi-arch images → Run workflow`.
4. As a fall-back you can force emulation by adding `--platform linux/amd64` after every `docker compose` command, but native arm64 images are strongly recommended.

---

## Prerequisites

### System Requirements
Expand Down Expand Up @@ -82,7 +93,7 @@ The main configurable environment variables include:
- **Service Images**:
- `MEGA_ENGINE_IMAGE`: Mega backend image (default: `public.ecr.aws/m8q5m4u3/mega:mono-0.1.0-pre-release`)
- `MEGA_UI_IMAGE`: Mega UI image (default: `public.ecr.aws/m8q5m4u3/mega:mega-ui-demo-0.1.0-pre-release`)
- `MEGA_DEV_IMAGE`: Orion Build Client image (default: `public.ecr.aws/m8q5m4u3/mega:mega-dev-0.1.0-pre-release`)
- `ORION_CLIENT_IMAGE`: Orion Build Client image (default: `public.ecr.aws/m8q5m4u3/mega:orion-client-0.1.0-pre-release`)
- `CAMPSITE_API_IMAGE`: Campsite API image (default: `public.ecr.aws/m8q5m4u3/mega:campsite-0.1.0-pre-release`)
- `CAMPSITE_RUN_MIGRATIONS`: Whether to run database migrations when the container starts; `1` (default) to run, can be changed to `0` after the first successful migration to skip and speed up subsequent starts.

Expand Down Expand Up @@ -494,7 +505,7 @@ The demo environment includes the following services:
- `mega`: Mega backend (Rust)
- `mega_ui`: Mega Web UI (Next.js)
- `orion_server`: Orion build server (Rust)
- `orion_build_client`: Orion build client (based on the mega-dev image)
- `orion_build_client`: Orion build client (based on the orion-client image)
- `campsite_api`: Campsite API (Ruby/Rails, built locally by default; if you have the encrypted development credentials configured you can pull the pre-built image directly via `CAMPSITE_API_IMAGE=public.ecr.aws/m8q5m4u3/mega:campsite-0.1.0-pre-release`)

For a detailed architecture diagram and dependency list, see the [Mega / Orion Demo architecture design document](./mega-orion-demo-compose-arch.md).
Expand Down
Loading