ustinovtikhon/android-build

By ustinovtikhon

Updated 6 months ago

Android build image: OpenJDK 21, Ruby 3.0, Fastlane 2.228, Android SDK 12 (API 36) on Ubuntu 22.04

Image
Languages & frameworks
1

3.4K

ustinovtikhon/android-build repository overview

Android Build Docker Image

This Docker image is designed for building Android applications, particularly in CI/CD environments like GitLab CI. It includes pre-installed dependencies to avoid repeated installations of Android SDK, Fastlane, Ruby, and other tools during builds. Based on Ubuntu 22.04 with OpenJDK 21.

Key Components and Versions

  • Base OS: Ubuntu 22.04 (Jammy Jellyfish)
  • Java/OpenJDK: 21 (LTS, via Eclipse Temurin)
  • Ruby: 3.0 (full installation)
  • Fastlane: 2.228.0 (Ruby gem for Android deployment automation)
  • Android SDK: Command-Line Tools 12.0 (supports API level 36 for Android 16)
    • Includes: platform-tools, platforms;android-36, build-tools;36.0.0
  • Other Tools: unzip, build-essential, curl, wget, git

Usage

Pull the Image
docker pull ustinovtikhon/android-build:openjdk21-ruby3-fastlane2.228-androidsdk12
In GitLab CI (.gitlab-ci.yml)

Replace your existing image with this one and simplify before_script (no need for SDK installation):

.common_android_build:
  image: ustinovtikhon/android-build:openjdk21-ruby3-fastlane2.228-androidsdk12
  tags:
    - common-tasks
    - docker
  stage: build
  when: manual
  cache:
    # Keep your caches as is
    ...
  script:
    - fastlane $LANE
  artifacts:
    # As in your original YAML
    ...
Local Testing

Run a container:

docker run -it -v $(pwd):/app ustinovtikhon/android-build:openjdk21-ruby3-fastlane2.228-androidsdk12 bash

Inside, you can run fastlane, sdkmanager, or Gradle commands directly.

Environment Variables

  • ANDROID_HOME: /opt/android-sdk
  • PATH: Includes SDK bins and gem bins
  • GEM_HOME: /opt/gem

Building from Dockerfile

If you need to customize, use the following Dockerfile as a base:

# (Paste the full Dockerfile from our previous discussion here)

Notes

  • Optimized for Android app builds (APK/AAB via Gradle/Fastlane).
  • Caches directories: /opt/gradle, /opt/gem, /opt/user_cache (align with your CI cache).
  • Size: ~3-4 GB (due to SDK).
  • Updates: For newer versions, rebuild with updated tags (e.g., fastlane 2.229).

For issues or contributions, contact via Docker Hub or GitHub.

Tag summary

Content type

Image

Digest

sha256:2468ad630

Size

918.6 MB

Last updated

6 months ago

docker pull ustinovtikhon/android-build