Skip to content

stephenbellanger/gitlab-ci-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

gitlab-ci-android

This Docker image is designed to provide an environment with the Android SDK and necessary tools for Android development. It is based on Debian 12.5 and includes OpenJDK 17, Android SDK tools, and the required platforms for building Android applications.

Features

  • Base Image: Debian 12.5
  • OpenJDK 17: Installed for Java-based Android development
  • Android SDK: Includes Android SDK command-line tools and necessary platforms for Android development
  • Locale Setup: Configured for both English and French locales
  • Non-interactive Setup: Ensures that all installation steps are automated

Prerequisites

  • Docker installed on your machine.

Build the Docker Image

  1. Clone this repository or download the Dockerfile.

  2. Build the Docker image by running the following command:

    docker build -t gitlab-ci-android .

Building, Tagging, and Pushing the Image

To build and push the Docker image to Docker Hub, follow these steps:

  1. Build the image for a specific platform (e.g., linux/amd64):

    docker buildx build --platform linux/amd64 -t sbellanger/gitlab-ci-android .
  2. Tag the image for versioning:

    docker tag sbellanger/gitlab-ci-android\:latest sbellanger/gitlab-ci-android:[TAG]
  3. Push the image to Docker Hub:

    docker push sbellanger/gitlab-ci-android:[TAG]

Log in to Docker Hub

Before pushing the image to Docker Hub, you need to log in. Run the following command to authenticate:

docker login

You will be prompted to enter your Docker Hub username and password.

Dockerfile Overview

Android SDK Setup

The image installs the Android SDK command-line tools and necessary platforms. The version of Android SDK tools is defined as 6858069. It automatically accepts Android SDK licenses.

Installed Packages

  • OpenJDK 17: Java Development Kit required for building Android applications.
  • Curl: Used for downloading SDK tools.
  • Git: For version control.
  • Unzip: To unzip the Android SDK tools.
  • Fontconfig and Locales: For proper rendering and localization.

Locale Configuration

The Docker image is configured with en_US.UTF-8 and fr_FR.UTF-8 locales for compatibility with Android development tools and scripts.

Android SDK Tools and Platforms

The following components are installed:

  • Command-line tools: The latest Android SDK tools.
  • Platform tools: For managing Android devices.
  • Build tools: For building APKs (version 34.0.0).
  • Android Platform: Targeting Android API level 34.

Usage

To start a container with the Android SDK, use the following command:

docker run -it gitlab-ci-android

This will open a shell inside the container with the Android SDK tools available.

Example Usage in GitLab CI

You can integrate this Docker image into your GitLab CI pipeline for building Android projects. Below is an example .gitlab-ci.yml file:

stages:
  - build

variables:
  ANDROID_HOME: "/sdk"
  ANDROID_SDK_ROOT: "/sdk"
  GRADLE_USER_HOME: "/gradle"

before_script:
  - export PATH="\$ANDROID_HOME/cmdline-tools/latest/bin:\$ANDROID_HOME/platform-tools:\$PATH"
  - yes | sdkmanager --licenses

build_android:
  stage: build
  image: sbellanger/gitlab-ci-android\:latest
  script:
    - echo "Starting build process"
    - sdkmanager "platforms;android-34" "build-tools;34.0.0"
    - ./gradlew assembleRelease
  only:
    - master

Contributing

If you'd like to contribute to this Docker image, feel free to open an issue or submit a pull request with improvements.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published