Docker/Podman provides a uniform build environment, without external dependencies, that you have to set up manually.
The goal is to make building properly with ota and signing easy for everyone.
Initial Setup
First we need to find the UID, that is used for Docker/Podman.
For Debian/Ubuntu this seems to be 100999 and on Fedora 52587,
which should be $subUID+$containerUID-1 according to the docker forums.
We need to manually create the required folders for the respective volumes
mkdir -p ~/docker_droid/src ~/docker_droid/dotfiles ~/docker_droid/ccache ~/docker_droid/logs ~/docker_droid/keys
Copy the required dotfiles from the host machines
cp ~/.gitconfig ~/docker_droid/dotfiles/
cp -r ~/.ssh ~/docker_droid/dotfiles/
and clone this repo
git clone https://github.com/SirRGB/dockdroid ~/docker_droid/minideb
Then we need to chown that directory to the Docker user:
sudo chown -R 100999:"${UID}" ~/docker_droid/src ~/docker_droid/dotfiles ~/docker_droid/ccache ~/docker_droid/logs ~/docker_droid/keys
sudo chown -R 52587:"${UID}" ~/docker_droid/src ~/docker_droid/dotfiles ~/docker_droid/ccache ~/docker_droid/logs ~/docker_droid/keys
(If you know a smarter way to do this please tell me,
I know the available subuids can be found with cat /etc/subuid | grep $USER | cut -d":" -f2
I just do not know if the container uid is predictable,
it seems to be 1000 for debian/ubuntu and 100 for fedora)
Let other users read the directory
sudo chmod -R 507 ~/docker_droid/src ~/docker_droid/dotfiles ~/docker_droid/ccache ~/docker_droid/logs ~/docker_droid/keys
Run the first docker build
docker compose up --force-recreate --build
Wait until it starts syncing and stop using ctrl + c
Find out the uid by running:
ls -n ~/docker_droid/src/Los15/.repo
Give ownership to the uid you found out:
(replace the 1st UID)
sudo chown -R UID:"${UID}" ~/docker_droid/src ~/docker_droid/dotfiles ~/docker_droid/ccache ~/docker_droid/logs ~/docker_droid/keys
And remove the incomplete sync
sudo rm -rf ~/docker_droid/src/Los15/
Variables
DEVICE
: Codename(s) of your device(s)ROM_DIR
: Only change the last part after src/. Defines the source path within the containerROM_MANIFEST
: URL of the rom manifest you want to syncROM_BRANCH
: Branch of the rom you want to syncLOCAL_MANIFEST
: Direct link to the local manifest(s) orCLONE_REPOS
: Links to the repo(s) to clone. Repo name MUST have the following pattern https://github.com/user/android_dir1_dir2_dir3/tree/branch, https://github.com/user/dir1_dir2_dir3/tree/branch or https://github.com/user/proprietary_dir1_dir2_dir3/tree/branch. Not recommended.
These variables should be defined in the target.env.
cp example.env target.env
DEVICE=cheeseburger,dumpling,TP1803
ROM_DIR=/droid_workdir/src/Los15
ROM_MANIFEST=https://github.com/LineageOS/android.git
ROM_BRANCH=lineage-22.2
LOCAL_MANIFEST=https://raw.githubusercontent.com/SirRGB/local_manifests/refs/heads/main/cheeseburgerdumpling/A15Lineage.xml,https://raw.githubusercontent.com/SirRGB/local_manifests/refs/heads/main/TP1803/A15Lineage.xml
- GitHub Upload
[GITHUB_TOKEN](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
OTA_REPO_URL
: for example [email protected]:user/ota_config, will also be used for uploading- Requires
GITHUB_TOKEN
or passwordless ssh keys added to your GitHub account
- SourceForge Upload
SF_USER
: Username of your accountSF_RELEASES_REPO
: Project name- Requires passwordless ssh keys added to your SourceForge account
- Telegram logging
[TELEGRAM_TOKEN](https://core.telegram.org/bots/features#botfather)
TELEGRAM_CHAT
: either as @xyz or the id
TIME_ZONE
: either as in the format UTC+2 or CETROM_BUILD_FLAGS
: if you want to define values likeWITH_GMS=true
you can do this in here, even with multiple of them separated by comma for separate builds or space for the same build- OTA Updates
- At least one file provider mentioned above
OTA_REPO_URL
: Any git hoster using ssh authentification i.e. GitHub, GitLab, CodeBerg,...
These variables should be defined in config.env.
GITHUB_TOKEN=thing1234
[email protected]:user/ota_config
dotfiles
: .gitconfig for syncing and .ssh for authentification. Needs to be copied from the host manually.keys
: Contains keys for signing the build. Will be generated automatically if not provided.logs
: Contains logs and error messages. Logs older than a day will be deleted on a rerun.ccache
: Used for build caching to speed up compilation. Set to 40GB by default. Can be disabled by overwriting the value with 0 for space-saving.
- After setting everything up you should do a test build with the default variables for testing. (Be sure to be in ~/docker_droid/minideb)
podman compose up --force-recreate --build
docker compose up --force-recreate --build
- Look up known issues in TODO.md
- If the error is undocumented you can uncomment this and send the part of the logs, where things go overboard via the issues or debug it on your own and send a pull request.
You can further speed up build times by using tmpfs as described here
- GitHub releases enforces a maximum file size of 2 GiB in their releases
- SourceForge restricts project size to 5-30 GiB depending on the download throughput
- GitLab releases are not feasible due to their 100 MiB attachment size limit
- CodeBerg releases are not feasible due to their 100 MiB size limit as well