{"id":50290377,"url":"https://github.com/rarestype/swift-docker-wasm","last_synced_at":"2026-05-28T05:34:22.371Z","repository":{"id":336151472,"uuid":"1148462236","full_name":"rarestype/swift-docker-wasm","owner":"rarestype","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-14T02:17:06.000Z","size":74,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-28T05:34:17.734Z","etag":null,"topics":["continuous-deployment","continuous-integration"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/repository/docker/tayloraswift/swiftwasm","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rarestype.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["tayloraswift"]}},"created_at":"2026-02-03T01:50:22.000Z","updated_at":"2026-05-14T04:21:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rarestype/swift-docker-wasm","commit_stats":null,"previous_names":["tayloraswift/swift-docker-wasm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rarestype/swift-docker-wasm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rarestype%2Fswift-docker-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rarestype%2Fswift-docker-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rarestype%2Fswift-docker-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rarestype%2Fswift-docker-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rarestype","download_url":"https://codeload.github.com/rarestype/swift-docker-wasm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rarestype%2Fswift-docker-wasm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33596316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["continuous-deployment","continuous-integration"],"created_at":"2026-05-28T05:34:19.606Z","updated_at":"2026-05-28T05:34:22.364Z","avatar_url":"https://github.com/rarestype.png","language":"Dockerfile","funding_links":["https://github.com/sponsors/tayloraswift"],"categories":[],"sub_categories":[],"readme":"# Self-Hosted Runner System\n\nThis repository includes the infrastructure to run ephemeral, containerized GitHub Actions runners. These runners are based on the `tayloraswift/swiftwasm:runner` Docker image, which pre-installs the Swift toolchain and WebAssembly SDKs.\n\nThis setup allows you to host a runner on a macOS machine (e.g., Mac Mini) using OrbStack or Docker Desktop, while keeping the environment isolated and ephemeral.\n\n## Architecture\n\n1. **Runner Image**: The `Runner.Dockerfile` builds an image (`tayloraswift/swiftwasm:runner`) containing:\n* Ubuntu 24.04\n* Swift Toolchain \u0026 WASM SDK\n* GitHub Actions Runner Agent\n* Entrypoint logic to register itself dynamically.\n\n\n2. **Ephemeral Loop**: The runner is designed to process **one job** and then terminate. This ensures a clean build environment for every run. A loop script on the host machine restarts the container immediately after it exits.\n3. **Host Machine**: The Mac Mini acts as the host. It does not need Swift installed; it only needs Docker (alternatively, OrbStack).\n\n## Host Setup (Mac Mini)\n\nTo set up a runner on a Mac Mini, you need a single script. This script handles:\n\n1. Fetching the latest runner logic.\n2. Preventing the Mac from sleeping (`caffeinate`).\n3. Injecting credentials for the target repository.\n\n### 1. Prerequisites\n\n* Docker Desktop (or OrbStack) installed and running.\n* A **GitHub Personal Access Token (Classic)** with `repo` scope.\n\n### 2. The Host Script (`start_ci_system.sh`)\n\nSave the following script on your Mac Mini (e.g., at `~/start_ci_system.sh`). This script can be used to target **any** repository (public or private) by changing the configuration variables.\n\n```bash\n#!/bin/bash\n\n# ==========================================\n# CONFIGURATION\n# ==========================================\n\n# 1. GitHub Personal Access Token (PAT)\n#    Must have 'repo' scope.\n#    SECURITY WARNING: Keep this file private on the host machine.\nYOUR_GITHUB_PAT=\"ghp_YOUR_TOKEN_HERE\"\n\n# 2. The Target Repository\n#    This is where the runner will register and listen for jobs.\n#    It does NOT need to be the same repo that hosts the Docker image.\nGITHUB_OWNER=\"tayloraswift\"\nGITHUB_REPO=\"swift-docker-wasm\"\n\n# 3. Runner Image\n#    The Docker Hub image to use (built from this repo).\nIMAGE_NAME=\"tayloraswift/swiftwasm:runner\"\n\n# 4. Runner Name\n#    A unique name to identify this runner in GitHub Settings.\nCONTAINER_NAME=\"runner-${GITHUB_REPO}\"\n\n# 5. Directory for script storage\nINSTALL_DIR=\"$HOME/swift-runner\"\n\n# 6. Remote Script URL\n#    The logic that runs inside the loop.\nREPO_SCRIPT_URL=\"https://raw.githubusercontent.com/tayloraswift/swift-docker-wasm/master/Scripts/runner-start.sh\"\n\n# ==========================================\n\n# Check for Docker\nif ! docker info \u003e /dev/null 2\u003e\u00261; then\n    echo \"❌ Error: Docker is not running.\"\n    echo \"   Please ensure the Docker engine is running.\"\n    exit 1\nfi\n\n# Setup Directory\nif [ ! -d \"$INSTALL_DIR\" ]; then\n    echo \"📂 Creating runner directory at $INSTALL_DIR...\"\n    mkdir -p \"$INSTALL_DIR\"\nfi\ncd \"$INSTALL_DIR\"\n\n# Download the latest loop logic\n# We fetch this fresh to ensure updates to the loop logic propagate immediately.\necho \"⬇️  Fetching latest runner logic from GitHub...\"\ncurl -s -o runner-start.sh -L \"$REPO_SCRIPT_URL\"\nchmod +x runner-start.sh\n\n# Export variables so the inner script picks them up\nexport GH_RUNNER_PAT=\"$YOUR_GITHUB_PAT\"\nexport GITHUB_OWNER=\"$GITHUB_OWNER\"\nexport GITHUB_REPO=\"$GITHUB_REPO\"\nexport IMAGE_NAME=\"$IMAGE_NAME\"\nexport CONTAINER_NAME=\"$CONTAINER_NAME\"\n# Pass the runner name to the container so it shows up correctly in GitHub UI\nexport RUNNER_NAME=\"${CONTAINER_NAME}-$(hostname)\"\n\necho \"------------------------------------------------\"\necho \"☕️ Starting runner for $GITHUB_OWNER/$GITHUB_REPO\"\necho \"   Target Image: $IMAGE_NAME\"\necho \"   Press Ctrl+C to stop.\"\necho \"------------------------------------------------\"\n\n# Run with caffeinate to prevent system sleep\ncaffeinate -i ./runner-start.sh\n\n```\n\n### 3. Usage\n\n1. Make the script executable:\n```bash\nchmod +x ~/start_ci_system.sh\n\n```\n\n\n2. Run it:\n```bash\n~/start_ci_system.sh\n\n```\n\n\n3. Go to your Repository Settings \u003e Actions \u003e Runners to verify the runner is \"Idle\".\n\n## Maintenance\n\n### Updating the Toolchain\n\nTo update the Swift version or SDK:\n\n1. Edit `Ubuntu.Latest.Dockerfile` (or relevant dockerfile) in this repository.\n2. Push to `master`.\n3. The `Deploy.yml` workflow will automatically rebuild `tayloraswift/swiftwasm:runner`.\n4. The active runner on the Mac Mini will detect the new image on its next loop iteration, pull it, and start using it immediately.\n\n\n## Running for Private Repositories\n\nTo use this runner with a private repository on a different account:\n\n1. Generate a PAT on the **other** account.\n2. Edit `~/start_ci_system.sh` on the Mac Mini.\n3. Update `YOUR_GITHUB_PAT`, `GITHUB_OWNER`, and `GITHUB_REPO`.\n4. Leave `IMAGE_NAME` as `tayloraswift/swiftwasm:runner`.\n5. Restart the script.\n\nThe runner will use the public tools from this repo to build the private code from the other repo.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frarestype%2Fswift-docker-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frarestype%2Fswift-docker-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frarestype%2Fswift-docker-wasm/lists"}