Skip to content

feat: add build-unity-image command for custom Unity Docker images#46

Merged
frostebite merged 3 commits intomainfrom
feat/build-image
May 7, 2026
Merged

feat: add build-unity-image command for custom Unity Docker images#46
frostebite merged 3 commits intomainfrom
feat/build-image

Conversation

@frostebite
Copy link
Copy Markdown
Member

@frostebite frostebite commented May 6, 2026

Summary

Adds game-ci build-unity-image — a CLI command that builds Unity editor Docker images with arbitrary module combinations, fully replacing the need for users to maintain custom Dockerfiles.

game-ci build-unity-image ubuntu windows-mono,linux-il2cpp --unity-version 2022.3.20f1

Why This Is Deep Integration

This is not a thin wrapper around docker build. The CLI codifies the entire game-ci/docker build pipeline — every version-specific patch, every platform-conditional dependency, every SDK setup step. A user running this command gets the exact same image that our CI publishes to Docker Hub.

All 18 Ubuntu patches ported:

# Patch Versions affected
1 linux-server module auto-install 2021.2.5+ with linux modules
2 windows-server module auto-install 2021.2.5+ with windows modules
3 IL2CPP --tool-chain-path=/ fix 2019.3.0–2019.3.5
4 IL2CPP --sysroot-path=/ --tool-chain-path=/ 2019.3.6+/2019.4.0
5 WebGL GZip compression (downgraded gzip) 2020.1/2020.2.0/2020.2.1
6 WebGL python2 2018/2019/2020/2021.1
7 WebGL brotli compression (egg copy) 2018/2019/2020.1
8 WebGL ffmpeg All webgl
9 build-essential + clang webgl + linux-il2cpp
10 libnotify4, libunwind-dev, libssl1.0.0 2019.x
11 Mac-mono x64arm64 case symlink 2021.x/2022.x
12 lld linker 2021.x linux-il2cpp
13 Android SDK setup (legacy sdkmanager) 2018.x
14 Android SDK setup (modules.json-based) 2019+
15 Android cmdline tools path 2021+
16 Android license acceptance (old + new) 2019/2020 + 2021+
17 Android platform-tools install 6000+
18 Android NDK symlink fix 2022.2+

Full Windows Dockerfile:

  • Multi-shell build (cmd → bash) with Unity Hub CLI
  • MSVCP100/MSVCR100 DLL copy
  • Git install + safe.directory config
  • Windows service enablement (nlasvc, netprofm)
  • Full Android setup with PowerShell helpers (Find-Module, Get-ModuleDestinationPath, Get-ModuleRenamedPath)
  • SetupAndroid + AcceptAndroidLicenses logic

Usage

# Desktop combo (Wwise/FMOD)
game-ci build-unity-image ubuntu windows-mono,linux-il2cpp,mac-mono \
  --unity-version 2022.3.20f1

# Push to registry
game-ci build-unity-image ubuntu windows-mono,linux-il2cpp \
  --unity-version 2022.3.20f1 \
  --tag ghcr.io/my-org/unity-editor:desktop \
  --push

# Windows with WebGL (issue #773)
game-ci build-unity-image windows webgl --unity-version 2022.3.20f1

GitHub Actions workflow

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: curl -fsSL https://raw.githubusercontent.com/game-ci/cli/main/install.sh | sh
      - run: |
          game-ci build-unity-image ubuntu windows-mono,linux-il2cpp \
            --unity-version 2022.3.20f1 \
            --tag unity-editor:desktop
      - uses: game-ci/unity-builder@v4
        with:
          customImage: unity-editor:desktop
          targetPlatform: StandaloneWindows64

What this enables

Phase 1 of #45

Phase Description Status
1 CLI build-unity-image with all patches ✅ This PR
2 Migrate game-ci/docker CI to use this command Future
3 Docs, game-ci init integration, reduce hosted matrix Future

No deprecation of existing images — this adds a new capability without removing anything.

Refs: #45, game-ci/unity-builder#771, game-ci/unity-builder#773

🤖 Generated with Claude Code

Adds `game-ci build-image [baseOs] [modules]` command that builds
Unity editor Docker images with arbitrary module combinations.

Usage:
  game-ci build-image ubuntu windows-mono,linux-il2cpp --unity-version 2022.3.20f1
  game-ci build-image ubuntu android --unity-version 6000.0.0f1 --push

The command:
- Generates a Dockerfile from templates (codifying game-ci/docker logic)
- Resolves Unity changeset automatically via unity-changeset
- Supports comma-separated modules (space-separated in Dockerfile)
- Supports custom tags and push to registry
- Works for both ubuntu and windows base OS

This enables users to build any module combination without waiting for
pre-built images, and dogfoods the same path our CI will eventually use.

Refs: #45, game-ci/unity-builder#771

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

@frostebite has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 12 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7c1c77ca-5da9-4af1-947b-2413e2b2f539

📥 Commits

Reviewing files that changed from the base of the PR and between c3b7da2 and 1365672.

⛔ Files ignored due to path filters (1)
  • dist/index.js is excluded by !**/dist/**
📒 Files selected for processing (3)
  • src/cli-commands.ts
  • src/command/build-image/build-image-command.ts
  • src/command/command-factory.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/build-image

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Leaves room for future build-godot-image, build-unreal-image etc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@frostebite frostebite changed the title feat: add build-image command for custom Unity Docker images feat: add build-unity-image command for custom Unity Docker images May 6, 2026
frostebite added a commit to game-ci/documentation that referenced this pull request May 6, 2026
Documents the game-ci build-unity-image command for building Docker
images with custom module combinations. Includes GitHub Actions examples
for both on-the-fly and pre-built workflows.

Refs: game-ci/cli#45, game-ci/cli#46

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
frostebite added a commit to game-ci/documentation that referenced this pull request May 7, 2026
* docs: clarify cli command surfaces

* docs: Unity CI reliability guide — self-hosted runners, failure diagnostics, caching

New pages:
- Advanced Topics > Self-Hosted Runner Reliability: Library cache strategy
  (HOT/WARM/COLD), DAG file repair, LFS pointer poisoning detection,
  profile-based cache invalidation, workspace-scoped process cleanup,
  licensing race mitigation, pre-crash Library backup pattern
- Advanced Topics > Unity Build Failure Diagnostics: 7-category failure
  classification (LICENSE, CRASH, COMPILE, PACKAGE, SKIP, EXIT_NEG1,
  GENERIC), detection signals, remediation per category, multi-phase retry
  chains with independent budgets, circuit breaker pattern, Step Summary
  integration
- Self-Hosting > Windows Self-Hosted Runner Setup: multi-runner topology,
  NSSM service management with self-healing layers, Unity Hub ghost process
  management, worker count configuration, Accelerator cold-start handling

Updated pages:
- Caching: added self-hosted cache integrity section (DAG repair, LFS
  poisoning, profile fingerprinting)
- Troubleshooting: added quick-fix entries for all 5 common Unity CI failure
  categories

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: clarify cli command surfaces

* docs: prefer orchestrate command

* docs: document config-defined providers

* docs: broaden diagnostics and self-hosted machine guides

* docs: rename self-hosted orchestrator guide

* docs: format cli command surface pages

* docs: orchestrator backlog features and streaming runner rename

- Rename "Standalone Streaming Hot Runner" to "Streaming Runner"
- Add GC timeout force and max cache entries documentation
- Add maxCacheEntries to caching inputs reference
- Add configFiles documentation to K8s and Docker provider pages
- Add init command documentation for workflow generation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: add minCacheEntries and cacheRetentionDays wiring docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* style: fix prettier formatting in docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* style: fix oxfmt formatting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* style: fix oxfmt formatting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: add custom images page for build-unity-image CLI command

Documents the game-ci build-unity-image command for building Docker
images with custom module combinations. Includes GitHub Actions examples
for both on-the-fly and pre-built workflows.

Refs: game-ci/cli#45, game-ci/cli#46

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@frostebite
Copy link
Copy Markdown
Member Author

Corresponding documentation PR: game-ci/documentation#565

@frostebite frostebite merged commit 1771fd3 into main May 7, 2026
13 checks passed
@frostebite frostebite deleted the feat/build-image branch May 7, 2026 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant