This Docker environment provides a complete, reproducible build system for creating Android images for the R36S game console based on LineageOS 18.1.
docker-build/
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker Compose configuration
├── build.sh # Build script (runs inside container)
├── cache/ # Mounted: stores .repo directory
├── results/ # Mounted: contains final ZIP files
└── README.md # This file
- Docker
- Docker Compose
- At least 200GB of free disk space
- 16GB+ RAM recommended
- Fast internet connection (first build downloads ~50GB of sources)
cd docker-build
docker compose up -d
docker compose logsThe first build will:
- Build the Docker image (~10-15 minutes)
- Initialize the repo and download sources (~1-2 hours depending on connection)
- Build the Android system (~2-4 hours depending on CPU)
- Generate the final ZIP file in
results/directory
Subsequent builds are incremental and reuse:
- Cached source code in
cache/.repo/ - Build artifacts in the container
Just run:
docker compose up -d
docker compose logsRemember, this will take multiple hours (or even days on slow computers).
You can customize the build by setting environment variables in docker-compose.yml or via a .env file.
To use a .env file:
cp .env.example .env
# Edit .env with your preferred settings
docker compose upNumber of parallel jobs for repo sync (default: 4)
environment:
- REPO_SYNC_JOBS=8Or via command line:
REPO_SYNC_JOBS=8 docker compose upNote: Higher values may be throttled by the remote server. Keep at 4 for initial sync.
Number of parallel jobs for compilation (default: nproc, all available CPU cores)
environment:
- BUILD_JOBS=40Or via command line:
BUILD_JOBS=40 docker compose upNote: Uses all available CPU cores by default. Reduce if you need CPU for other tasks during build.
Build variant target (default: lineage_r36s-userdebug)
environment:
- BUILD_TARGET=lineage_r36s-userdebugBranch to use for local_manifests repository (default: main)
environment:
- LOCAL_MANIFESTS_BRANCH=analog-stick-mouseOr via command line:
LOCAL_MANIFESTS_BRANCH=analog-stick-mouse docker compose upThis allows you to use different device configurations or patches by selecting different branches from the local_manifests repository. For example, to use the analog-stick-mouse branch:
LOCAL_MANIFESTS_BRANCH=analog-stick-mouse docker compose upTo prevent throttling, the default is set to 4 parallel jobs. If you have a fast connection and want to speed up the initial sync:
REPO_SYNC_JOBS=8 docker compose upAfter a successful build, you'll find the final ZIP file in:
docker-build/results/lineage-18.1-YYYYMMDD-HHMM-r36s-android.img.zip
This file can be flashed to your R36S device.
The build requires significant disk space:
- Source code: ~50GB (cached in
cache/) - Build artifacts: ~100GB (stored in container)
- Final output: ~1GB (in
results/)
If builds fail due to memory issues, you can:
- Increase Docker's memory limit
- Reduce parallel jobs:
BUILD_JOBS=20 docker compose up - For sync issues:
REPO_SYNC_JOBS=2 docker compose up
To start fresh (this will re-download everything):
# Remove cached sources
rm -rf cache/.repo/*
# Remove results
rm -rf results/*
# Rebuild container
docker compose up --buildTo enter the container for debugging:
docker compose run --rm r36s-builder bashIf you want to run build steps manually:
# Start container with shell
docker compose run --rm r36s-builder bash
# Inside container, run build commands manually
repo sync -j4
source build/envsetup.sh
lunch lineage_r36s-userdebug
mka -j$(nproc) bootimage systemimage
cd device/gameconsole/r36s
./mkimg.sh
mv *.zip /build/results/To update to the latest sources:
docker compose run --rm r36s-builder bash
# Inside container:
repo sync -j4
# Then exit and rebuild:
exit
docker compose upThe cache/ directory stores the .repo metadata and git objects. This prevents re-downloading sources on each build.
Size: ~50GB after initial sync
To preserve this between builds, never delete cache/.repo/.
The results/ directory contains the final flashable ZIP files.
You can safely clean old builds:
rm results/*.zip- Base Image: Ubuntu 24.04
- LineageOS Version: 18.1 (Android 11)
- Device Target: R36S game console
- Build System: AOSP/LineageOS build system
- Toolchain: GCC Linaro 6.3.1
For issues with:
- The build process: Check the Android/LineageOS documentation
- The R36S device: Visit the andr36oid GitHub repository
- This Docker setup: Review the build logs and Dockerfile
- LineageOS Team: https://lineageos.org/
- andr36oid: https://github.com/andr36oid