alpine-android
alpine-android copied to clipboard
🐋 Small docker image for building & testing Android applications.
Alpine Android Docker Images
Variants
There are three variants of the image, all based on bellsoft/liberica-openjdk-alpine
:
- JDK8 images are based on Liberica JDK 8u345-1 and uses the tag's suffix
-jdk8
. - JDK11 images are based on Liberica JDK 11.0.16.1-1 and uses the tag's suffix
-jdk11
. - JDK17 images are based on Liberica JDK 17.0.4.1-1 and uses the tag's suffix
-jdk17
.
Which one should I use?
The recommended version is JDK8 if you are not using AGP v7.0.0+ or you are using DataBinding with a version of AGP prior to v7.0.0. Otherwise you must use JDK11 version because AGP v7.0.0+ will only work with version 11+ of the JDK.
If you want to use a JDK11 image with a version of AGP prior to v7, remember that JAXB is not included and you must add the following dependencies if using DataBinding:
// In Groovy
implementation "org.glassfish.jaxb:jaxb-runtime:2.3.3"
// or in Kotlin DSL
implementation("org.glassfish.jaxb:jaxb-runtime:2.3.3")
Tagging
API level | JDK8 | JDK11 | JDK17 |
---|---|---|---|
Base Image | jdk8 latest-jdk8 |
jdk11 , latest , latest-jdk11 |
jdk17 , latest-jdk17 |
Android 9.0 (28) | android-28-jdk8 |
android-28 , android-28-jdk11 |
android-28-jdk17 |
Android 10 (29) | android-29-jdk8 |
android-29 , android-29-jdk11 |
android-29-jdk17 |
Android 11 (30) | android-30-jdk8 |
android-30 , android-30-jdk11 |
android-30-jdk17 |
Android 12 (31) | android-31-jdk8 |
android-31 , android-31-jdk11 |
android-31-jdk17 |
Android 12L (32) | android-32-jdk8 , latest-jdk8 |
android-32 , android-32-jdk11 , latest , latest-jdk11 |
android-32-jdk17 , latest-jdk17 |
Android 13 (33) | android-33-jdk8 |
android-33 , android-33-jdk11 |
android-33-jdk17 |
:warning: The tags
latest
andandroid-XX
will be using the JDK8 base image until July 28th, 2022. After that date, those tags will be targeting JDK11.
Versioning
Since January 1st 2021, new versions now include the date it was published so is possible to revert to a previous version. The versioning only applies to tags with the JDK version specified. The tag's format is: android-XX-jdkZZ-vYYYY.MM.DD
, where:
-
XX
is the API level. -
ZZ
is the version of the JDK. -
YYYY
is the year of the release version. -
MM
is the month of the year of the release version with leading zeros. -
DD
is the day of the month of the release version with leading zeros.
A valid example would be android-30-jdk11-v2021.01.01
. Here are listed all the versions.
:memo: Versioning is not available for
alpine-android-base
.
Content
See content of Android Base image
Path | Version | Description | Location |
---|---|---|---|
extras;google;instantapps | 1.9.0 | Google Play Instant Development SDK | extras/google/instantapps/ |
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/ |
platform-tools | 33.0.2 | Android SDK Platform-Tools | platform-tools/ |
Extend from Alpine Android Base
Use the following configuration in your Dockerfile. After that, you can install any Android package available. To install an Android package, include the following line on your Dockerfile:
RUN sdkmanager <list-of-packages>
If you want to install an Alpine package available. To install an Android package, include the following line on your Dockerfile:
RUN apk add --no-cache <list-of-packages>
See content of Android 9 (Pie) image
Path | Version | Description | Location |
---|---|---|---|
build-tools;28.0.3 | 28.0.3 | Android SDK Build-Tools | build-tools/28.0.3/ |
extras;google;instantapps | 1.9.0 | Google Play Instant Development SDK | extras/google/instantapps/ |
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/ |
platform-tools | 33.0.2 | Android SDK Platform-Tools | platform-tools/ |
platforms;android-28 | 6 | Android SDK Platform 28 | platforms/android-28/ |
See content of Android 10 (Q) image
Path | Version | Description | Location |
---|---|---|---|
build-tools;29.0.3 | 29.0.3 | Android SDK Build-Tools | build-tools/29.0.3/ |
extras;google;instantapps | 1.9.0 | Google Play Instant Development SDK | extras/google/instantapps/ |
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/ |
platform-tools | 33.0.2 | Android SDK Platform-Tools | platform-tools/ |
platforms;android-29 | 5 | Android SDK Platform 29 | platforms/android-29/ |
See content of Android 11 (R) image
Path | Version | Description | Location |
---|---|---|---|
build-tools;30.0.3 | 30.0.3 | Android SDK Build-Tools | build-tools/30.0.3/ |
extras;google;instantapps | 1.9.0 | Google Play Instant Development SDK | extras/google/instantapps/ |
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/ |
platform-tools | 33.0.2 | Android SDK Platform-Tools | platform-tools/ |
platforms;android-30 | 3 | Android SDK Platform 30 | platforms/android-30/ |
See content of Android 12 (S) image
Path | Version | Description | Location |
---|---|---|---|
build-tools;31.0.0 | 31.0.0 | Android SDK Build-Tools | build-tools/31.0.0/ |
extras;google;instantapps | 1.9.0 | Google Play Instant Development SDK | extras/google/instantapps/ |
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/ |
platform-tools | 33.0.2 | Android SDK Platform-Tools | platform-tools/ |
platforms;android-31 | 1 | Android SDK Platform 31 | platforms/android-31/ |
See content of Android 12L image
Path | Version | Description | Location |
---|---|---|---|
build-tools;32.0.0 | 32.0.0 | Android SDK Build-Tools | build-tools/32.0.0/ |
extras;google;instantapps | 1.9.0 | Google Play Instant Development SDK | extras/google/instantapps/ |
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/ |
platform-tools | 33.0.2 | Android SDK Platform-Tools | platform-tools/ |
platforms;android-32 | 1 | Android SDK Platform 32 | platforms/android-32/ |
See content of Android 13 image
Path | Version | Description | Location |
---|---|---|---|
build-tools;33.0.0 | 33.0.0 | Android SDK Build-Tools | build-tools/33.0.0/ |
extras;google;instantapps | 1.9.0 | Google Play Instant Development SDK | extras/google/instantapps/ |
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/ |
platform-tools | 33.0.2 | Android SDK Platform-Tools | platform-tools/ |
platforms;android-33 | 1 | Android SDK Platform 33 | platforms/android-33/ |
Containers registries
Because of the DockerHub rate limits, the image is now in three different containers registries:
- DockerHub: Base Image and Android Image.
- GitHub Container Registry: Base Image and Android Image.
- Quay: Base Image and Android Image.
Pulling from the different registries
Replace <tag>
with one of the current available tags.
DockerHub pulling
You can pull a specific Docker image from DockerHub with the following command:
docker pull alvrme/alpine-android-base:<tag>
docker pull alvrme/alpine-android:<tag>
GHCR pulling
You can pull a specific Docker image from GitHub Container Registry with the following command:
docker pull ghcr.io/alvr/alpine-android-base:<tag>
docker pull ghcr.io/alvr/alpine-android:<tag>
Quay pulling
You can pull a specific Docker image from Quay with the following command:
docker pull quay.io/alvr/alpine-android-base:<tag>
docker pull quay.io/alvr/alpine-android:<tag>
Use as Base Image
Replace <tag>
with one of the current available tags.
DockerHub base image
You can use the Docker images from DockerHub as a base image for creating a new one:
FROM alvrme/alpine-android-base:<tag>
FROM alvrme/alpine-android:<tag>
GHCR base image
You can use the Docker images from GitHub Container Registry as a base image for creating a new one:
FROM ghcr.io/alvr/alpine-android-base:<tag>
FROM ghcr.io/alvr/alpine-android:<tag>
Quay base image
You can use the Docker images from Quay as a base image for creating a new one:
FROM quay.io/alvr/alpine-android-base:<tag>
FROM quay.io/alvr/alpine-android:<tag>
Run container
Replace <tag>
with one of the current available tags.
The command below will create a new container based on the specific image. It will open in the /home/android
directory and the various available commands in the PATH
will be able to be executed. Once the container is closed, it will be deleted. To keep the container after closing it, you have to remove --rm
from the command.
DockerHub run container
Run the container from the DockerHub image:
docker run --rm -it alvrme/alpine-android-base:<tag>
docker run --rm -it alvrme/alpine-android:<tag>
GHCR run container
Run the container from the GitHub Container Registry image:
docker run --rm -it ghcr.io/alvr/alpine-android-base:<tag>
docker run --rm -it ghcr.io/alvr/alpine-android:<tag>
Quay run container
Run the container from the Quay image:
docker run --rm -it quay.io/alvr/alpine-android-base:<tag>
docker run --rm -it quay.io/alvr/alpine-android:<tag>
Extras
The base image also includes the extras
command that contains small utilities that are not installed by default, since their use is not widespread.
These extras are executed with the command extras <command>
and are the following
Fastlane
fastlane is a tool for iOS and Android developers to automate tedious tasks like generating screenshots, dealing with provisioning profiles, and releasing your application. Visit their documentation for more information.
This command allows you to install fastlane
. There are two variants:
extras fastlane
This command allows you to install the latest version of fastlane
. If you want to use a specific version, the command is as follows:
extras fastlane <version>
NDK
The Android NDK is a toolset that lets you implement parts of your app in native code, using languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages.
This command allows you to install NDK and CMAKE using the latest versions available (NDK: 23.0.7599858
; CMAKE: 3.18.1
):
extras ndk
Is also possible to specify the version of NDK and CMAKE with:
extras ndk [--ndk | -n <version>] [--cmake | -c <version>]
It is not necessary to enter both versions, is possible to omit one.
Extending from Alpine Android Base
Difference between Alpine Android and Alpine Android Base
The main difference between Alpine Android and Alpine Android Base is that the first one includes the corresponding build-tools
and platforms;android
versions. All Alpine Android versions share 95% of the code. Using a base image with the common part makes it easier to maintain.