From 3958431f707521bb36321dc9a37e5db17d38b153 Mon Sep 17 00:00:00 2001 From: Anton Malinskiy Date: Tue, 13 Feb 2018 00:03:27 +0700 Subject: [PATCH 1/3] Create README.md --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e1cd58f --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +[![Build Status](https://travis-ci.org/agoda-com/docker-emulator-android.svg?branch=master)](https://travis-ci.org/agoda-com/docker-emulator-android) +[![Docker Stars](https://img.shields.io/docker/stars/agoda-com/docker-emulator-android.svg)]() +[![Docker Pulls](https://img.shields.io/docker/pulls/agoda-com/docker-emulator-android.svg)]() + +# docker-emulator-android +docker-emulator-android is one of the components of [android-farm](https://github.com/agoda-com/android-farm). It runs android emulator with hardware acceleration in a container. + +# Features +- Compatible with [OpenSTF](https://openstf.io) +- Optimized for performance + - hardware acceleration using KVM + - QEMU 2 +- Changing emulator spec is supported by + - overriding config.ini variables using `ANDROID_CONFIG` + - overriding emulator cmd args using `EMULATOR_OPTS` and `QEMU_OPTS` + - overriding adb ports using `CONSOLE_PORT (default 5554)`, `ADB_PORT (default 5555)` +- VNC server (port 5900) +- Google API's enabled + +# Usage +For example to run default emulator options with Marshmallow (API 23): +```console +$ docker run --privileged -v /dev/kvm:/dev/kvm agoda-com/docker-emulator-android-23:latest +$ adb connect VIP:5555 +``` + +If you want to start different configuration of device, for example a 7 inch tablet, you need to override `config.ini` variables: + +```console +$ docker run --privileged -e ANDROID_CONFIG="skin.name=600x1024;hw.lcd.density=160;hw.lcd.height=600;hw.lcd.width=1024;hw.device.name=7in WSVGA (Tablet);avd.ini.displayname=7 WSVGA (Tablet) API 23;" -v /dev/kvm:/dev/kvm agoda-com/docker-emulator-android-23:latest +``` + +For all the options available please check the [official documentation](https://developer.android.com/studio/run/emulator-commandline.html) From 3e72cb420af37868f3768c612002416235ea4341 Mon Sep 17 00:00:00 2001 From: Anton Malinskiy Date: Tue, 13 Feb 2018 11:53:30 +0700 Subject: [PATCH 2/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e1cd58f..e0e5988 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,14 @@ docker-emulator-android is one of the components of [android-farm](https://githu # Usage For example to run default emulator options with Marshmallow (API 23): ```console -$ docker run --privileged -v /dev/kvm:/dev/kvm agoda-com/docker-emulator-android-23:latest +$ docker run --rm --privileged -e ANDROID_ARCH="x86" -v /dev/kvm:/dev/kvm agoda-com/docker-emulator-android-23:latest $ adb connect VIP:5555 ``` If you want to start different configuration of device, for example a 7 inch tablet, you need to override `config.ini` variables: ```console -$ docker run --privileged -e ANDROID_CONFIG="skin.name=600x1024;hw.lcd.density=160;hw.lcd.height=600;hw.lcd.width=1024;hw.device.name=7in WSVGA (Tablet);avd.ini.displayname=7 WSVGA (Tablet) API 23;" -v /dev/kvm:/dev/kvm agoda-com/docker-emulator-android-23:latest +$ docker run --rm --privileged -e ANDROID_ARCH="x86" -e ANDROID_CONFIG="skin.name=600x1024;hw.lcd.density=160;hw.lcd.height=600;hw.lcd.width=1024;hw.device.name=7in WSVGA (Tablet);avd.ini.displayname=7 WSVGA (Tablet) API 23;" -v /dev/kvm:/dev/kvm agoda-com/docker-emulator-android-23:latest ``` For all the options available please check the [official documentation](https://developer.android.com/studio/run/emulator-commandline.html) From 952f26ae6237d154af71f4b1d29b345024ac5ab4 Mon Sep 17 00:00:00 2001 From: Anton Malinskiy Date: Tue, 13 Feb 2018 13:02:09 +0700 Subject: [PATCH 3/3] Fix Dockerfile generation sed should replace globally added unzip -q --- Makefile | 8 ++++---- templates/Dockerfile | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index b6848fe..e59f239 100644 --- a/Makefile +++ b/Makefile @@ -4,10 +4,10 @@ VERSIONS = android-16 android-17 android-18 android-19 android-21 android-22 and generate: for version in $(VERSIONS); do \ mkdir -p ./build/$$version ; \ - sed "s/{{ platform }}/$$version/" templates/Dockerfile > build/$$version/Dockerfile ; \ - sed "s/{{ platform }}/$$version/" templates/config.ini > build/$$version/config.ini ; \ - sed "s/{{ platform }}/$$version/" templates/start.sh > build/$$version/start.sh ; \ - sed "s/{{ platform }}/$$version/" templates/Makefile > build/$$version/Makefile ; \ + sed "s/{{ platform }}/$$version/g" templates/Dockerfile > build/$$version/Dockerfile ; \ + sed "s/{{ platform }}/$$version/g" templates/config.ini > build/$$version/config.ini ; \ + sed "s/{{ platform }}/$$version/g" templates/start.sh > build/$$version/start.sh ; \ + sed "s/{{ platform }}/$$version/g" templates/Makefile > build/$$version/Makefile ; \ cp base/* ./build/$$version ; \ done diff --git a/templates/Dockerfile b/templates/Dockerfile index 8b4162e..8c4efe7 100644 --- a/templates/Dockerfile +++ b/templates/Dockerfile @@ -27,13 +27,14 @@ RUN dpkg --add-architecture i386 && \ # Install Android SDK curl -L $LINK_ANDROID_SDK > /tmp/android-sdk-linux.zip && \ - unzip /tmp/android-sdk-linux.zip -d /opt/android-sdk-linux/ && \ + unzip -q /tmp/android-sdk-linux.zip -d /opt/android-sdk-linux/ && \ rm /tmp/android-sdk-linux.zip && \ # Customized steps per specific platform yes | sdkmanager --no_https --licenses && \ sdkmanager --no_https emulator tools platform-tools "platforms;{{ platform }}" "system-images;{{ platform }};google_apis;x86" --verbose && \ echo no | avdmanager create avd -n "x86" --package "system-images;{{ platform }};google_apis;x86" --tag google_apis && \ + # Unfilter devices (now local because CI downloads from github are unstable) # curl -o /root/.android/adb_usb.ini https://raw.githubusercontent.com/apkudo/adbusbini/master/adb_usb.ini && \