Skip to content

Commit

Permalink
- Separate android-sdk image into a base image and separate image for…
Browse files Browse the repository at this point in the history
… each API level.

- Improve CI workflow.
  • Loading branch information
ychescale9 committed Jun 18, 2020
1 parent e8c9e4b commit 4991ea1
Show file tree
Hide file tree
Showing 28 changed files with 204 additions and 74 deletions.
9 changes: 9 additions & 0 deletions .github/filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
base_image:
- android-sdk-*.Dockerfile
- publish_android_sdk_base_image.sh
sdk_images:
- android-sdk-*.Dockerfile
- publish_android_sdk_image.sh
emulator_images:
- android-emulator-*.Dockerfile
- publish_android_emulator_image.sh
28 changes: 0 additions & 28 deletions .github/workflows/build-and-publish-emulator-images.yml

This file was deleted.

74 changes: 74 additions & 0 deletions .github/workflows/build-and-publish-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build and Publish Images

on:
schedule:
- cron: '0 0 * * 3' # build and publish images every Wednesday
push:
branches:
- main

jobs:
publish-base-image:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: dorny/[email protected]
id: filter
with:
filters: '.github/filters.yml'
- name: Docker login
if: ${{ github.event_name == 'schedule' || steps.filter.outputs.base_image == 'true' }}
run: echo "$DOCKER_TOKEN" | docker login --username=$DOCKER_USER --password-stdin
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
- name: Build and publish android-sdk-base.Dockerfile
if: ${{ github.event_name == 'schedule' || steps.filter.outputs.base_image == 'true' }}
run: sh publish_android_sdk_base_image.sh

publish-sdk-image:
needs: publish-base-image
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]

steps:
- uses: actions/checkout@v2
- uses: dorny/[email protected]
id: filter
with:
filters: '.github/filters.yml'
- name: Docker login
if: ${{ github.event_name == 'schedule' || steps.filter.outputs.base_image == 'true' || steps.filter.outputs.sdk_images == 'true' }}
run: echo "$DOCKER_TOKEN" | docker login --username=$DOCKER_USER --password-stdin
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
- name: Build and publish android-sdk-${{ matrix.api-level }}.Dockerfile
if: ${{ github.event_name == 'schedule' || steps.filter.outputs.base_image == 'true' || steps.filter.outputs.sdk_images == 'true' }}
run: sh publish_android_sdk_image.sh ${{ matrix.api-level }}

publish-emulator-image:
needs: publish-sdk-image
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]

steps:
- uses: actions/checkout@v2
- uses: dorny/[email protected]
id: filter
with:
filters: '.github/filters.yml'
- name: Docker login
if: ${{ github.event_name == 'schedule' || steps.filter.outputs.base_image == 'true' || steps.filter.outputs.sdk_images == 'true' || steps.filter.outputs.emulator_images == 'true' }}
run: echo "$DOCKER_TOKEN" | docker login --username=$DOCKER_USER --password-stdin
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
- name: Build and publish android-emulator-${{ matrix.api-level }}.Dockerfile
if: ${{ github.event_name == 'schedule' || steps.filter.outputs.base_image == 'true' || steps.filter.outputs.sdk_images == 'true' || steps.filter.outputs.emulator_images == 'true' }}
run: sh publish_android_emulator_image.sh ${{ matrix.api-level }}
23 changes: 0 additions & 23 deletions .github/workflows/build-and-publish-sdk-image.yml

This file was deleted.

38 changes: 32 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@

Docker images for Android SDK and Emulators

## Android SDK Image
## Android SDK Base Image

Downloads the Android SDK and installs build tools and platform tools.

### Image name

`reactivecircus/android-sdk`
`reactivecircus/android-sdk-base`

### Image version

Image versions (tags) can be found on [Docker Hub](https://hub.docker.com/r/reactivecircus/android-sdk/tags/)
Image versions (tags) can be found on [Docker Hub](https://hub.docker.com/r/reactivecircus/android-sdk-base/tags/)

### Current SDK Versions

* Build tools - `30.0.0`
* Platform - `29`

### Base image

Expand All @@ -31,6 +30,33 @@ Image versions (tags) can be found on [Docker Hub](https://hub.docker.com/r/reac
* `unzip`
* `git`

## Android SDK Images

Downloads Android SDK platform for a specific API level.

### Image name

`reactivecircus/android-sdk-<api-level>`

### Availabel Images

The following images are available on Docker Hub:

- [android-emulator-21](https://hub.docker.com/r/reactivecircus/android-sdk-21/tags/)
- [android-emulator-22](https://hub.docker.com/r/reactivecircus/android-sdk-22/tags/)
- [android-emulator-23](https://hub.docker.com/r/reactivecircus/android-sdk-23/tags/)
- [android-emulator-24](https://hub.docker.com/r/reactivecircus/android-sdk-24/tags/)
- [android-emulator-25](https://hub.docker.com/r/reactivecircus/android-sdk-25/tags/)
- [android-emulator-26](https://hub.docker.com/r/reactivecircus/android-sdk-26/tags/)
- [android-emulator-27](https://hub.docker.com/r/reactivecircus/android-sdk-27/tags/)
- [android-emulator-28](https://hub.docker.com/r/reactivecircus/android-sdk-28/tags/)
- [android-emulator-29](https://hub.docker.com/r/reactivecircus/android-sdk-29/tags/)
- [android-emulator-30](https://hub.docker.com/r/reactivecircus/android-sdk-30/tags/)

### Base image

`reactivecircus/android-sdk-base:latest`

## Android Emulator Images

Downloads and installs packages required for hardware acceleration with **kvm**, and the x86 / x86_64 Android system image for the `<api-level>`.
Expand Down Expand Up @@ -60,7 +86,7 @@ The following images are available on Docker Hub:

### Base image

`reactivecircus/android-sdk:latest`
`reactivecircus/android-sdk-<api-level>:latest`

### Included packages

Expand All @@ -84,4 +110,4 @@ The [new emulator 28.1.8 Canary](https://androidstudio.googleblog.com/2019/02/em

### Scheduled release

The `android-emulator-<api-level>` images are automatically re-built and pushed **weekly** to package the latest stable version of the `emulator` SDK component which is updated frequently with improvements and bug fixes.
All images are automatically re-built and pushed **weekly** to package the latest stable version of the SDK components.
2 changes: 1 addition & 1 deletion android-emulator-21.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM reactivecircus/android-sdk:latest
FROM reactivecircus/android-sdk-21:latest

# Install packages
RUN apt-get -qqy update && \
Expand Down
2 changes: 1 addition & 1 deletion android-emulator-22.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM reactivecircus/android-sdk:latest
FROM reactivecircus/android-sdk-22:latest

# Install packages
RUN apt-get -qqy update && \
Expand Down
2 changes: 1 addition & 1 deletion android-emulator-23.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM reactivecircus/android-sdk:latest
FROM reactivecircus/android-sdk-23:latest

# Install packages
RUN apt-get -qqy update && \
Expand Down
2 changes: 1 addition & 1 deletion android-emulator-24.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM reactivecircus/android-sdk:latest
FROM reactivecircus/android-sdk-24:latest

# Install packages
RUN apt-get -qqy update && \
Expand Down
2 changes: 1 addition & 1 deletion android-emulator-25.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM reactivecircus/android-sdk:latest
FROM reactivecircus/android-sdk-25:latest

# Install packages
RUN apt-get -qqy update && \
Expand Down
2 changes: 1 addition & 1 deletion android-emulator-26.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM reactivecircus/android-sdk:latest
FROM reactivecircus/android-sdk-26:latest

# Install packages
RUN apt-get -qqy update && \
Expand Down
2 changes: 1 addition & 1 deletion android-emulator-27.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM reactivecircus/android-sdk:latest
FROM reactivecircus/android-sdk-27:latest

# Install packages
RUN apt-get -qqy update && \
Expand Down
2 changes: 1 addition & 1 deletion android-emulator-28.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM reactivecircus/android-sdk:latest
FROM reactivecircus/android-sdk-28:latest

# Install packages
RUN apt-get -qqy update && \
Expand Down
2 changes: 1 addition & 1 deletion android-emulator-29.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM reactivecircus/android-sdk:latest
FROM reactivecircus/android-sdk-29:latest

# Install packages
RUN apt-get -qqy update && \
Expand Down
2 changes: 1 addition & 1 deletion android-emulator-30.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM reactivecircus/android-sdk:latest
FROM reactivecircus/android-sdk-30:latest

# Install packages
RUN apt-get -qqy update && \
Expand Down
6 changes: 6 additions & 0 deletions android-sdk-21.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM reactivecircus/android-sdk-base:latest

# Install Android platform
ENV API_LEVEL=21

RUN sdkmanager --install "platforms;android-${API_LEVEL}"
6 changes: 6 additions & 0 deletions android-sdk-22.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM reactivecircus/android-sdk-base:latest

# Install Android platform
ENV API_LEVEL=22

RUN sdkmanager --install "platforms;android-${API_LEVEL}"
6 changes: 6 additions & 0 deletions android-sdk-23.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM reactivecircus/android-sdk-base:latest

# Install Android platform
ENV API_LEVEL=23

RUN sdkmanager --install "platforms;android-${API_LEVEL}"
6 changes: 6 additions & 0 deletions android-sdk-24.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM reactivecircus/android-sdk-base:latest

# Install Android platform
ENV API_LEVEL=24

RUN sdkmanager --install "platforms;android-${API_LEVEL}"
6 changes: 6 additions & 0 deletions android-sdk-25.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM reactivecircus/android-sdk-base:latest

# Install Android platform
ENV API_LEVEL=25

RUN sdkmanager --install "platforms;android-${API_LEVEL}"
6 changes: 6 additions & 0 deletions android-sdk-26.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM reactivecircus/android-sdk-base:latest

# Install Android platform
ENV API_LEVEL=26

RUN sdkmanager --install "platforms;android-${API_LEVEL}"
6 changes: 6 additions & 0 deletions android-sdk-27.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM reactivecircus/android-sdk-base:latest

# Install Android platform
ENV API_LEVEL=27

RUN sdkmanager --install "platforms;android-${API_LEVEL}"
6 changes: 6 additions & 0 deletions android-sdk-28.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM reactivecircus/android-sdk-base:latest

# Install Android platform
ENV API_LEVEL=28

RUN sdkmanager --install "platforms;android-${API_LEVEL}"
6 changes: 6 additions & 0 deletions android-sdk-29.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM reactivecircus/android-sdk-base:latest

# Install Android platform
ENV API_LEVEL=29

RUN sdkmanager --install "platforms;android-${API_LEVEL}"
6 changes: 6 additions & 0 deletions android-sdk-30.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM reactivecircus/android-sdk-base:latest

# Install Android platform
ENV API_LEVEL=30

RUN sdkmanager --install "platforms;android-${API_LEVEL}"
6 changes: 2 additions & 4 deletions android-sdk.Dockerfile → android-sdk-base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ RUN mkdir "$ANDROID_HOME" .android \
# Accept all licenses
RUN yes | sdkmanager --licenses

# Install Android build tools, platform and platform tools
ENV API_LEVEL=30 \
ANDROID_BUILD_TOOLS_VERSION=30.0.0
# Install Android build tools and platform tools
ENV ANDROID_BUILD_TOOLS_VERSION=30.0.0

RUN touch ~/.android/repositories.cfg
RUN sdkmanager --install "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
"platforms;android-${API_LEVEL}" \
"platform-tools"
11 changes: 11 additions & 0 deletions publish_android_sdk_base_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

# generate a new image version from the current time
IMAGE_VERSION=`date "+v%Y_%m_%d-%H-%M-%S"`

# build the docker image with new version and tag
docker build -t reactivecircus/android-sdk-base:latest -t reactivecircus/android-sdk-base:${IMAGE_VERSION} -f android-sdk-base.Dockerfile .

# publish to Docker Hub
docker push reactivecircus/android-sdk-base:${IMAGE_VERSION}
docker push reactivecircus/android-sdk-base:latest
9 changes: 6 additions & 3 deletions publish_android_sdk_image.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/usr/bin/env bash

# API level passed in as argument
API=$1

# generate a new image version from the current time
IMAGE_VERSION=`date "+v%Y_%m_%d-%H-%M-%S"`

# build the docker image with new version and tag
docker build -t reactivecircus/android-sdk:latest -t reactivecircus/android-sdk:${IMAGE_VERSION} -f android-sdk.Dockerfile .
docker build -t reactivecircus/android-sdk-${API}:latest -t reactivecircus/android-sdk-${API}:${IMAGE_VERSION} -f android-sdk-${API}.Dockerfile .

# publish to Docker Hub
docker push reactivecircus/android-sdk:${IMAGE_VERSION}
docker push reactivecircus/android-sdk:latest
docker push reactivecircus/android-sdk-${API}:${IMAGE_VERSION}
docker push reactivecircus/android-sdk-${API}:latest

0 comments on commit 4991ea1

Please sign in to comment.