Sign inSign up

optsoft/android

By optsoft

Updated 7 months ago

Node 20, OpenJDK 17, Ruby, Bundler & gcloud for Android/React Native CI builds (Bitbucket, etc.)

Image
Developer tools
0

1.8K

optsoft/android repository overview

Full Description for Docker Hub (optsoft/android)

Copy this content into the Full Description field of your Docker Hub repository.


optsoft/android

Docker image for building Android (React Native) apps in CI pipelines. Pre-installs Node, Java, Ruby, Bundler and Google Cloud CLI so pipelines skip repeated apt-get install on every run.


Why we created it

Our Bitbucket pipeline was slow because each Android build step had to:

  1. Run apt-get update and install OpenJDK 17, Ruby, build-essential, ca-certificates, etc.
  2. Add the Google Cloud apt repo and install google-cloud-cli
  3. Run gem install bundler

This added 2–5 minutes to every build. We created this image to pre-install these tools once and reuse them across runs.


What it does

This image provides a ready-to-use environment for Android CI that includes:

ComponentVersionPurpose
Node.js20React Native, Yarn, Metro bundler
OpenJDK17Gradle and Android builds
Ruby3.1Fastlane
Bundler(latest)Ruby gem management for Fastlane
Google Cloud CLI(latest)Workload Identity Federation (WIF) for Play Store deploy
localesen_US.UTF-8Avoid locale warnings in CI

Base image: Debian Bookworm Slim (node:20-bookworm-slim)


Improvements it introduces

  1. Faster builds: Saves ~2–5 minutes per pipeline run by skipping apt-get and gem install.
  2. Reproducible builds: Same environment across runs and branches.
  3. Less network usage: No repeated downloads of packages in CI.
  4. Multi-architecture: Works on Linux amd64 (CI) and arm64 (Apple Silicon local; note: local Docker testing with mounted macOS SDK is not supported due to binary incompatibility).

Use case

Designed for Bitbucket Pipelines (or similar CI) that build React Native Android apps and deploy to Google Play. The CI runner must provide the Android SDK; this image does not include it (SDK is platform-specific and large).


Usage in Bitbucket Pipelines

- step:
    name: Android · Build AAB
    image: optsoft/android:latest
    script:
      - export ENV=development
      - export FASTLANE_ANDROID_LANE=deploy_internal
      - export PREBUILT_CI_IMAGE=1
      - chmod +x scripts/ci-android.sh
      - ./scripts/ci-android.sh

Set PREBUILT_CI_IMAGE=1 so the CI script skips the apt-get install block.


What this image does NOT include

  • Android SDK – CI must provide it (e.g. Bitbucket environment or another image with SDK).
  • Android NDK – Comes with the SDK when needed.
  • project dependenciesyarn install and bundle install still run per pipeline.

Local testing on macOS

Not supported. Mounting the macOS Android SDK into this Linux container fails because the SDK contains macOS binaries (cmake, ninja, hermes) that cannot run on Linux. For local Android builds on Mac, run directly on the host (no Docker).


Rebuilding for CI (Linux amd64)

If you build on Apple Silicon, the image is arm64. Bitbucket runs Linux amd64. Rebuild for amd64 before pushing:

docker build --platform linux/amd64 -f Dockerfile.android-ci -t optsoft/android:latest .
docker push optsoft/android:latest

Tags

  • latest – Current stable build
  • Version tags (e.g. 2025-02) – For pinning specific builds

Source

Built from a Dockerfile in a React Native project. The Dockerfile is maintained alongside the app and optimized for that pipeline.

Tag summary

Content type

Image

Digest

sha256:6b407e60b

Size

663 MB

Last updated

7 months ago

docker pull optsoft/android