An optimized Docker image that includes the Android SDK.
It includes the following components:
The docker image is a publicly automated build on Docker Hub
based on the Dockerfile in this repo, so there is no hidden stuff in it. To pull the latest docker image:
docker pull matheussouza/docker-android-build-tools
Hint: You can use a tag to a specific stable version,
rather than latest of docker image, to avoid breaking your build.
e.g. matheussouza/docker-android-build-tools:v1.0.0.
Take a look at the Releases section, to see all the available releases.
You can use this docker image to build your Android project with a single docker command:
cd <android project directory> # change working directory to your project root directory.
docker run --rm -v $(pwd):/app matheussouza/docker-android-build-tools bash -c 'cd /app; ./gradlew build'
To build .aab bundle release, use ./gradlew bundleRelease:
cd <android project directory> # change working directory to your project root directory.
docker run --rm -v $(pwd):/app matheussouza/docker-android-build-tools bash -c 'cd /app; ./gradlew bundleRelease'
Run docker image with interactive bash shell:
docker run -it -v $(pwd):/app matheussouza/docker-android-build-tools /bin/bash
Add the following arguments to the docker command to cache the home gradle folder:
-v "$HOME/.dockercache/gradle":"/root/.gradle"
e.g.
docker run --rm -v $(pwd):/app -v "$HOME/.dockercache/gradle":"/root/.gradle" matheussouza/docker-android-build-tools bash -c 'cd /project; ./gradlew build'
If you have an Android project in a Bitbucket repository and want to use the pipeline feature to build it,
you can simply specify this docker image.
Here is an example of bitbucket-pipelines.yml:
image: matheussouza/docker-android-build-tools:latest
pipelines:
default:
- step:
caches:
- gradle
- gradle-wrapper
- android-emulator
script:
- bash ./gradlew assemble
definitions:
caches:
gradle-wrapper: ~/.gradle/wrapper
android-emulator: $ANDROID_HOME/system-images/android-21
The caches are used to store downloaded dependencies from previous builds, to speed up the next builds.
Java 11 is installed.
| docker-android-build-tools version | Android Compile SDK | Build Tools version | SDK Tools version |
|---|---|---|---|
| v1.0.0 | 30 | 30.0.3 | 8092744 |
| v1.2.0 | 33 | 33.0.0 | 9123335 |
If versions other than those listed are needed, just change the respective ENVs in Docerfile and build the image.
If you want to build the docker image by yourself, you can use following command. The image itself is around 1.3 GB, so check your free disk space before building it.
docker build -t docker-android-build-tools .
If you want to enhance this docker image or fix something, feel free to send pull request.
Content type
Image
Digest
sha256:5b34742b4…
Size
646.5 MB
Last updated
about 3 years ago
docker pull matheussouza/docker-android-build-tools