Docker based build machine with Android SDK for Jenkins CI
2.1K
This image is intended to use as vm which is triggered only for the duration of the build and then discarded. From the job perspective, it looks like it's an ordinary slave. All the hard work is done by the Jenkins docker plugin: https://wiki.jenkins-ci.org/display/JENKINS/Docker+Plugin also the image requires environment variables injection plugin for ANDROID_HOME and PATH configuration https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin
Because jenkins creates new instance of the VM for each build, there is no need to have some machines running in advance. This comes with (positive) side-effect that all dependencies are always freshly downloaded, so you won't end in situation where you have somehow cached dependency and you can't build elsewhere. To speed build up, you can use https://archiva.apache.org/index.cgi as local caching proxy.
The build is run under user jenkins who has password jenkins.
jenkins@96c59182c5e7:~$ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
jenkins@96c59182c5e7:~$ android list target
Available Android targets:
id: 1 or "android-24"
Name: Android N
Type: Platform
API level: 24
Revision: 1
build-tools: 24.0.0
Open dockerhttp://192.168.0.5:4243jenkinsslave/android_apps_sdk:android-24-build-tools-24.0.0
(note image can be specified exactly to a tag, or you can leave it to use latest)/home/jenkinsandroid_apps
(this label is then used in the job configuration, as if it was any other slave)android_apps/home/jenkins/android-sdk.envnow it only needs git and gradle configured to install required version
on your docker machine me@docker01:~$ run
docker run -it jenkinsslave/android_apps_sdk /bin/bash
which will bring latest, or you can specify older version:
docker run -it jenkinsslave/android_apps_sdk:android-24-build-tools-24.0.0 /bin/bash
docker run -it jenkinsslave/android_apps_sdk:android-23-build-tools-23.0.3 /bin/bash
You can find the full list on https://hub.docker.com/r/jenkinsslave/android_apps_sdk/tags/
Once image is running root@cf79a127b169:/# get same shell as jenkins using su - jenkins
docker pull -it jenkinsslave/android_apps_sdk /bin/bash
in your Dockerfile
FROM jenkinsslave/android_apps_sdk
RUN ...
Content type
Image
Digest
Size
897.8 MB
Last updated
over 10 years ago
docker pull jenkinsslave/android_apps_sdk