Fast, rootless Android CI/CD image with AGP 9.x, SDK 35/36/37, JDK 17/21, GMD & Auto-Detection.
10K+
hateum/android-ci-box)A battle-tested, high-performance, and rootless Docker container engineered for Android CI/CD automation across GitHub Actions, GitLab CI, Jenkins, and Bitbucket Pipelines.
Features a dual-mode network engine (public internet & enterprise intranet with auto-proxy, custom CA certificates, and Nexus mirrors), native multi-arch compilation (amd64 and arm64), and zero-config dynamic auto-detection of project SDK and Java toolchains.
:slim vs :latest)Choose the variant that best balances download speed and emulator capabilities:
| Feature / Tool | :slim (Fast Builds) | :latest / :full (Batteries-Included) |
|---|---|---|
| Download Size (Compressed) | ~2.2 GB (~35% smaller!) | ~3.5 GB |
| Android SDKs (API 35, 36, 37) | ✅ Yes | ✅ Yes |
| Build-Tools (35, 36, 37) | ✅ Yes | ✅ Yes |
| Dual OpenJDK (17 & 21) | ✅ Yes (switch-jdk) | ✅ Yes (switch-jdk) |
| Ruby 4.0.9 + Fastlane 2.241.2 | ✅ Yes | ✅ Yes |
| Bundletool 1.18.3 & Android CLI | ✅ Yes | ✅ Yes |
| Dual-Mode Enterprise Network | ✅ Yes | ✅ Yes |
| Sigstore Cosign & SPDX SBOM | ✅ Yes | ✅ Yes |
| Android Emulator (GMD & UI Tests) | ❌ No (Stripped for speed) | ✅ Yes (Preinstalled on amd64) |
| Recommended For | Linting, Unit Tests, Assemble, Fastlane Deploy | End-to-End Instrumented Tests & GMD |
hateum/android-ci-box? (Feature Comparison)| Capability | Standard Android CI Images | hateum/android-ci-box |
|---|---|---|
| Silicon Architecture | x86_64 only (Emulated on ARM via slow QEMU) | Native Multi-Arch (amd64 + arm64) (Full native silicon speed on Apple Silicon & AWS Graviton) |
| Project Setup | Manual SDK/JDK setup scripts per repo | Zero-Config Dynamic Auto-Detection (compileSdk, buildTools, Java 17/21) in <50ms |
| Java Runtimes | Single JDK version (fixed at build time) | Dual-JDK (OpenJDK 21 + 17) with instant CLI/Env toggle (switch-jdk) |
| Security & Permissions | Hardcoded root (fails on OpenShift/K8s) | Universal Rootless (777 permissions), runs safely under any UID (1000:0, 1001:1001) |
| Vulnerability Audit | Often contains unpatched high/critical CVEs | Zero Unfixed Critical CVEs (strictly audited via Trivy SARIF gates) |
| Enterprise Network | Custom Dockerfiles required for proxies & certs | Auto-imported CA certs, automatic HTTP proxy & Nexus/Artifactory mirror derivation |
| Deployment Tools | Slow gem install fastlane on every build | Precompiled Ruby 4.0.9 + Fastlane 2.241.2 ready out-of-the-box in /opt/rbenv |
| C/C++ NDK & CMake | Missing or forces massive 4GB+ image size | Dynamic On-Demand Engine (install-ndk-version & INSTALL_NDK_VERSION) |
| GitHub Action Integration | Raw container scripting required | Official Composite Action (uses: hatem-noureddine/android-ci@v1) |
| Build Performance Tuning | Default Gradle daemon issues in Docker | Auto-injected CI Optimization Init-Script (Parallel, Caching, VFS off) |
| Testing & Emulation | Complex X11/VNC setup or broken display | Native Gradle Managed Devices (GMD) with SwiftShader Headless GPU acceleration |
| Health Diagnostics | No diagnostic tooling | Built-in ci-doctor & detect-android-project CLI utilities with JSON reporting |
+-----------------------------------------------------------------------------------------+
| Tier 1: Base Operating System (Ubuntu 26.04 LTS) |
| Native Multi-Arch Matrix: linux/amd64 (x86_64) | linux/arm64 (aarch64) |
+-----------------------------------------------------------------------------------------+
| | |
v v v
+------------------------+ +------------------------+ +------------------------+
| Tier 2: Java Runtimes | | Tier 2: Ruby Runtime | | Tier 2: System Tools |
| - OpenJDK 21 (Default) | | - Ruby 4.0.9 (rbenv) | | - Python 3 & Pip (PEP) |
| - OpenJDK 17 (Instant) | | - Bundler 4.0.23 | | - GitHub CLI (gh) |
| - switch-jdk helper | | - Fastlane 2.241.2 | | - curl, git-lfs, zip |
+------------------------+ +------------------------+ +------------------------+
| | |
+-----------------------------------+-----------------------------------+
|
v
+-----------------------------------------------------------------------------------------+
| Tier 3: Android Build Engine & Standalone CLI Tooling |
| - Gradle 9.8.2 Standalone + Dynamic Gradle Wrapper Auto-Execution |
| - Android Gradle Plugin (AGP) 8.x & 9.x Fully Supported |
| - Android SDK Platforms: android-35, android-36, android-37 (Pre-installed) |
| - Android Build-Tools: 35.0.0, 36.0.0, 37.0.0 (Pre-installed) |
| - Google Android CLI ('android') & standalone Bundletool 1.18.3 |
+-----------------------------------------------------------------------------------------+
|
v
+-----------------------------------------------------------------------------------------+
| Tier 4: Zero-Config Dynamic Project Auto-Detection Engine |
| - detect-android-project: Scans build.gradle(.kts) & libs.versions.toml (<50ms) |
| - Multi-module maximum aggregation: automatically resolves highest compileSdk |
| - Auto-switches Java 17/21 and installs missing SDKs/build-tools on container startup |
| - Cross-compatibility: Automatically forces Java 17 if Gradle Wrapper < 8.5 is detected|
+-----------------------------------------------------------------------------------------+
|
v
+-----------------------------------------------------------------------------------------+
| Tier 5: Automated Testing & Deployment Tooling |
| - Fastlane 2.241.2: Native Google Play Console deployment & lane automation |
| - Gradle Managed Devices (GMD): SwiftShader Headless GPU & KVM Hardware Acceleration |
| - Unit Testing, Android Lint & ProGuard/R8 bytecode optimization |
+-----------------------------------------------------------------------------------------+
|
v
+-----------------------------------------------------------------------------------------+
| Tier 6: Dual-Mode Universal Network & Rootless Security |
| - Mode 1: Public Internet (Direct unthrottled access to Google & Maven Central) |
| - Mode 2: Enterprise Intranet (Auto-Proxy, Custom CA Import, Nexus/Artifactory Mirrors) |
| - Rootless Hardened: Universal 777 permissions (Runs under UID 1000:0, OpenShift, K8s) |
| - Trivy Certified: 0 Unfixed Critical CVEs |
+-----------------------------------------------------------------------------------------+
Verify container health, Java versions, SDK packages, and network connectivity in seconds:
# Run full interactive diagnostic with network connectivity probes
docker run --rm -v "$(pwd)":/project hateum/android-ci-box:latest ci-doctor
# Inspect project requirements vs installed components (<50ms)
docker run --rm -v "$(pwd)":/project hateum/android-ci-box:latest detect-android-project
# Launch interactive shell
docker run -it --rm -v "$(pwd)":/project -w /project hateum/android-ci-box:latest /bin/bash
Zero manual setup: the container auto-configures JDK and SDK matching your project:
# Build Release APK
docker run --rm \
-v "$(pwd)":/project \
-v "$HOME/.gradle":/home/runner/.gradle \
-w /project \
hateum/android-ci-box:latest \
./gradlew assembleRelease --no-daemon
# Build Release AAB and extract universal APK with Bundletool
docker run --rm \
-v "$(pwd)":/project \
-w /project \
hateum/android-ci-box:latest \
bash -c "./gradlew bundleRelease --no-daemon && \
bundletool build-apks --bundle=app/build/outputs/bundle/release/app-release.aab --output=/tmp/app.apks --mode=universal"
Native headless emulator execution with SwiftShader GPU acceleration and KVM support:
docker run --rm \
--device /dev/kvm \
-v "$(pwd)":/project \
-w /project \
hateum/android-ci-box:latest \
./gradlew pixel8api35DebugAndroidTest --no-daemon
Deploy directly to Google Play Internal track without installing Ruby gems:
docker run --rm \
-v "$(pwd)":/project \
-w /project \
-e SUPPLY_JSON_KEY_DATA="${PLAY_STORE_JSON_KEY}" \
hateum/android-ci-box:latest \
bundle exec fastlane android deploy_internal
The container includes a built-in static inspection engine (detect-android-project) executed by entrypoint.sh on startup:
compileSdk Resolution: Scans all sub-modules and selects the maximum target SDK. If missing from /opt/android-sdk, it auto-downloads it on-the-fly.buildToolsVersion Resolution: Scans for explicit definitions or falls back to ${compileSdk}.0.0 (standard AGP behavior).jvmToolchain or JavaVersion.VERSION_XX.Explicit variables take absolute precedence over project auto-detection:
| Variable | Values / Format | Default | Purpose |
|---|---|---|---|
JAVA_VERSION | 17, 21 | 21 | Overrides active JDK (updates JAVA_HOME and symlinks). |
INSTALL_SDK_VERSION | 33, 34, 35, 36, 37 | Auto-detected | Installs specified Android SDK platform if not present. |
INSTALL_BUILD_TOOLS | 34.0.0, 33.0.3, ... | Auto-derived | Installs specified Android build-tools version. |
INSTALL_NDK_VERSION | 27.2.12479018, 26.1... | Auto-detected | Installs specified Android NDK on-demand. |
INSTALL_CMAKE_VERSION | 3.22.1, 3.28... | Auto-detected | Installs specified Android CMake on-demand. |
ENABLE_CI_OPTIMIZATIONS | true, false | true | Enables/disables automatic Gradle CI parallel & build caching init-script. |
AUTO_DETECT_PROJECT | true, false | true | Enables/disables static analysis of project build files. |
AUTO_INSTALL_SDK | true, false | true | Allows/disallows on-the-fly downloading of missing SDK components. |
HTTP_PROXY / HTTPS_PROXY | http://proxy:8080 | None | Injected into ~/.gradle/gradle.properties automatically. |
NO_PROXY | localhost,127.0.0.1,.corp | None | Converted to Java pipe-delimited format for gradle.properties. |
NEXUS_URL | https://nexus.corp/repository | None | Derives mirror hooks for Google, MavenCentral, GradlePortal. |
NEXUS_RUBY_URL | https://nexus.corp/rubygems | Auto-derived | Configures Bundler and RubyGems mirror (auto-derived from NEXUS_URL if omitted). |
OFFLINE_MODE | true, false | false | Opt-in: enforces strict offline build execution (startParameter.offline=true). |
CORPORATE_CA_URL | URL string | None | Downloads and imports corporate SSL certificate on startup. |
INSECURE_CA_DOWNLOAD | true, false | false | Disables TLS verification strictly during initial CA download if bootstrap cert is self-signed. |
GRADLE_BUILD_CACHE_URL | URL string | None | Configures remote HTTP Gradle build caching in init.d. |
| Utility | Location | Usage Example | Purpose |
|---|---|---|---|
ci-doctor | /usr/local/bin/ci-doctor | ci-doctor [--summary | --json] | Complete system, Java, SDK, network, and project diagnostics. |
detect-android-project | /usr/local/bin/detect-android-project | detect-android-project [path] [--json] | Ultra-fast (<50ms) static parser for compileSdk, buildTools, and JDK. |
switch-jdk | /usr/local/bin/switch-jdk | switch-jdk 17 or source switch-jdk 21 | Seamlessly toggles between OpenJDK 17 and OpenJDK 21. |
install-sdk-version | /usr/local/bin/install-sdk-version | install-sdk-version 34 or 34.0.0 | Installs platforms or build-tools via Google Android CLI. |
install-ndk-version | /usr/local/bin/install-ndk-version | install-ndk-version 27.2.12479018 [cmake] | Dynamically installs Android NDK and CMake with rootless permissions. |
bundletool | /usr/local/bin/bundletool | bundletool build-apks --bundle=app.aab | Google Bundletool 1.18.3 CLI for universal APKs and testing. |
android | ${ANDROID_HOME}/cmdline-tools/latest/bin/android | android sdk list, android --version | Official Google Android CLI. |
uses: hatem-noureddine/android-ci@v1)name: Android CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build & Test Android App
uses: hatem-noureddine/android-ci@v1
with:
run: |
ci-doctor --summary
./gradlew lintRelease testReleaseUnitTest assembleRelease
container: image: hateum/android-ci-box:latest)name: Android CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-24.04
container:
image: hateum/android-ci-box:latest
options: --user 1000:0
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
- name: Run Diagnostics & Lint
run: |
ci-doctor --summary
./gradlew lintRelease testReleaseUnitTest --no-daemon
- name: Build Release Bundle
run: ./gradlew bundleRelease --no-daemon
- name: Fastlane Google Play Deploy (Optional)
run: bundle exec fastlane android deploy_internal
env:
SUPPLY_JSON_KEY_DATA: ${{ secrets.PLAY_STORE_JSON_KEY }}
.gitlab-ci.yml)default:
image: hateum/android-ci-box:latest
before_script:
- export GRADLE_USER_HOME="${CI_PROJECT_DIR}/.gradle"
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .gradle/caches/
- .gradle/wrapper/
stages: [ test, build ]
lint_and_test:
stage: test
script:
- ci-doctor --summary
- ./gradlew lintRelease testReleaseUnitTest --no-daemon
build_aab:
stage: build
script:
- ./gradlew bundleRelease --no-daemon
artifacts:
paths:
- app/build/outputs/bundle/release/*.aab
Production-ready, battle-tested templates are located in ci-templates/:
spec: inputs: ...).-u 1000:1000) with volume cache and JUnit reports.workflow_call).When running CI on ARM64 nodes (where the Google x86_64 emulator is unavailable), use the built-in CLI dispatcher to run tests on physical Google Firebase Test Lab devices:
run-firebase-testlab --auto-build --device Pixel8 --api 34
Mount your enterprise certificates (.crt, .cer, .pem) into /certificates:
docker run --rm \
-v /path/to/corporate-ca.crt:/certificates/corp.crt \
hateum/android-ci-box:latest ./gradlew assembleRelease
Certificates are automatically registered in the system truststore and Java cacerts.
Pass your internal repository URL to redirect Google Maven and MavenCentral automatically:
docker run --rm \
-e NEXUS_URL="https://nexus.corp.internal/repository" \
-e NEXUS_USER="ci-builder" \
-e NEXUS_PASSWORD="secretPassword123" \
hateum/android-ci-box:latest ./gradlew assembleRelease
Yes. Universal read/write permissions (777) are set on /project, /builds, /opt, and /home/runner/.gradle, allowing execution under any UID (e.g. --user 1000:0 or --user 1001:1001).
PKIX path building failed?Mount your corporate certificate into /certificates:
docker run -v /path/to/corp-cert.crt:/certificates/corp.crt hateum/android-ci-box:latest ...
Google compiles the Linux SDK Emulator (emulator) exclusively for x86_64. On ARM64 Linux hosts (e.g. AWS Graviton), compilation, linting, unit tests, and Fastlane run at native silicon speed, while headless emulator tests require an x86_64 runner.
This project is open-source software licensed under the MIT License.
Content type
Image
Digest
sha256:d5ec81958…
Size
1.9 GB
Last updated
1 day ago
docker pull hateum/android-ci-box