mirror of
https://github.com/budtmo/docker-android.git
synced 2026-07-31 04:07:25 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d13e60a122 | ||
|
|
c4be3a1ac0 | ||
|
|
7c7eed4a3d | ||
|
|
d0271e0be0 | ||
|
|
9d71ecded7 | ||
|
|
81af88e7a4 | ||
|
|
a8f7fd2d02 | ||
|
|
de71e5156c | ||
|
|
bcf27f0489 | ||
|
|
972445a8bc | ||
|
|
460e0b8daf | ||
|
|
3673d195ea | ||
|
|
77c6ac8507 | ||
|
|
cd35f4a3ab | ||
|
|
217df7cd65 | ||
|
|
ccfdef4fe8 | ||
|
|
b40ec48136 | ||
|
|
064331de0e | ||
|
|
5ef52ca622 | ||
|
|
15c51a4ab1 | ||
|
|
7e2b364c08 | ||
|
|
0b18e4995c | ||
|
|
f0fb5ef009 | ||
|
|
ec0c381fb6 | ||
|
|
58f7693024 | ||
|
|
40f6e67d83 |
@@ -41,17 +41,17 @@ Advantages compare with other docker-android projects
|
|||||||
List of Docker images
|
List of Docker images
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|Supported OS |Android version |API level |Image name |Image status |
|
|OS |Android version |API |Browser |Browser version |Chromedriver version |Image |Size |
|
||||||
|:---|:---|:---|:---|:---:|
|
|:---|:---|:---|:---|:---|:---|:---|:---|
|
||||||
|Linux|5.0.1|21|butomo1989/docker-android-x86-5.0.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.0.1 "Get your own image badge on microbadger.com")|
|
|Linux|5.0.1|21|browser|37.0|2.12|butomo1989/docker-android-x86-5.0.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.0.1 "Get your own image badge on microbadger.com")|
|
||||||
|Linux|5.1.1|22|butomo1989/docker-android-x86-5.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.1.1 "Get your own image badge on microbadger.com")|
|
|Linux|5.1.1|22|browser|39.0|2.13|butomo1989/docker-android-x86-5.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.1.1 "Get your own image badge on microbadger.com")|
|
||||||
|Linux|6.0|23|butomo1989/docker-android-x86-6.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-6.0 "Get your own image badge on microbadger.com")|
|
|Linux|6.0|23|browser|44.0|2.18|butomo1989/docker-android-x86-6.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-6.0 "Get your own image badge on microbadger.com")|
|
||||||
|Linux|7.0|24|butomo1989/docker-android-x86-7.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.0 "Get your own image badge on microbadger.com")|
|
|Linux|7.0|24|chrome|51.0|2.23|butomo1989/docker-android-x86-7.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.0 "Get your own image badge on microbadger.com")|
|
||||||
|Linux|7.1.1|25|butomo1989/docker-android-x86-7.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.1.1 "Get your own image badge on microbadger.com")|
|
|Linux|7.1.1|25|chrome|55.0|2.28|butomo1989/docker-android-x86-7.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.1.1 "Get your own image badge on microbadger.com")|
|
||||||
|Linux|8.0|26|butomo1989/docker-android-x86-8.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-8.0 "Get your own image badge on microbadger.com")|
|
|Linux|8.0|26|chrome|58.0|2.31|butomo1989/docker-android-x86-8.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-8.0 "Get your own image badge on microbadger.com")|
|
||||||
|Linux|8.1|27|butomo1989/docker-android-x86-8.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-8.1 "Get your own image badge on microbadger.com")|
|
|Linux|8.1|27|chrome|61.0|2.33|butomo1989/docker-android-x86-8.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-8.1 "Get your own image badge on microbadger.com")|
|
||||||
|All |-|-|butomo1989/docker-android-real-device|[](https://microbadger.com/images/butomo1989/docker-android-real-device "Get your own image badge on microbadger.com")|
|
|All |-|-|-|-|-|butomo1989/docker-android-real-device|[](https://microbadger.com/images/butomo1989/docker-android-real-device "Get your own image badge on microbadger.com")|
|
||||||
|Linux|All|All|butomo1989/docker-android-genymotion|[](https://microbadger.com/images/butomo1989/docker-android-genymotion "Get your own image badge on microbadger.com")|
|
|Linux|All|All|All|All|All|butomo1989/docker-android-genymotion|[](https://microbadger.com/images/butomo1989/docker-android-genymotion "Get your own image badge on microbadger.com")|
|
||||||
|
|
||||||
List of Devices
|
List of Devices
|
||||||
---------------
|
---------------
|
||||||
@@ -144,6 +144,24 @@ There is [example of compose file] to run complete selenium grid and docker-andr
|
|||||||
```bash
|
```bash
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
### Google Play Services
|
||||||
|
|
||||||
|
The Google play services (v12.8.74) will be downloaded from [apklinker](https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b51570a214a8/com.google.android.gms_12.8.74-040700-204998136_12874026_MinAPI23_(x86)(nodpi)_apklinker.com.apk) in [utils bash file] file when emulator booted . you can edit [utils bash file] as you need any adb stuffs as the following to disable emulators animation to increase performance:
|
||||||
|
|
||||||
|
adb shell "settings put global window_animation_scale 0.0"
|
||||||
|
adb shell "settings put global transition_animation_scale 0.0"
|
||||||
|
adb shell "settings put global animator_duration_scale 0.0"
|
||||||
|
|
||||||
|
mount it as follow in docker-compose file :
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- $PWD/videos:/tmp/video
|
||||||
|
- $PWD/src/utils.sh:/root/src/utils.sh
|
||||||
|
|
||||||
|
or when run directly
|
||||||
|
```bash
|
||||||
|
docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -v $PWD/src/utils.sh:/root/src/utils.sh -v $PWD/example/sample_apk:/root/tmp -e DEVICE="Nexus 5" -e APPIUM=true -e CONNECT_TO_GRID=true -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 --name android-container butomo1989/docker-android-x86-8.1
|
||||||
|
```
|
||||||
|
|
||||||
Build Android project
|
Build Android project
|
||||||
---------------------
|
---------------------
|
||||||
@@ -212,6 +230,15 @@ adb connect <docker-machine-ip-address>:5555
|
|||||||
|
|
||||||
**Note:** You need to have Android Debug Bridge (adb) installed in your host machine.
|
**Note:** You need to have Android Debug Bridge (adb) installed in your host machine.
|
||||||
|
|
||||||
|
Get rid of unauthorized device popup while connecting to the emulator outside the container
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
In order to connect to the emulator using already generated adbkey on your machine you will need to mount your `.android` folder to the container (this is needed only when you work with emulator based on playstore image):
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -v <local Android key directory>:/root/.android/ ...
|
||||||
|
```
|
||||||
|
|
||||||
SMS Simulation
|
SMS Simulation
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
@@ -342,6 +369,7 @@ Special Thanks
|
|||||||
[compose]: <images/compose.png>
|
[compose]: <images/compose.png>
|
||||||
[line]: <https://github.com/butomo1989/docker-android/blob/master/docker-compose.yml#L70>
|
[line]: <https://github.com/butomo1989/docker-android/blob/master/docker-compose.yml#L70>
|
||||||
[example of compose file]: <docker-compose.yml>
|
[example of compose file]: <docker-compose.yml>
|
||||||
|
[utils bash file]: <src/utils.sh>
|
||||||
[docker-compose]: <https://docs.docker.com/compose/install/>
|
[docker-compose]: <https://docs.docker.com/compose/install/>
|
||||||
[1.13.0]: <https://github.com/docker/compose/releases/tag/1.13.0>
|
[1.13.0]: <https://github.com/docker/compose/releases/tag/1.13.0>
|
||||||
[Genymotion Cloud]: <https://www.genymotion.com/cloud/>
|
[Genymotion Cloud]: <https://www.genymotion.com/cloud/>
|
||||||
|
|||||||
+4
-3
@@ -89,20 +89,21 @@ ARG PROCESSOR=x86
|
|||||||
ARG SYS_IMG=x86
|
ARG SYS_IMG=x86
|
||||||
ARG IMG_TYPE=google_apis
|
ARG IMG_TYPE=google_apis
|
||||||
ARG BROWSER=android
|
ARG BROWSER=android
|
||||||
ARG CHROME_DRIVER=24
|
ARG CHROME_DRIVER=2.40
|
||||||
ENV ANDROID_VERSION=$ANDROID_VERSION \
|
ENV ANDROID_VERSION=$ANDROID_VERSION \
|
||||||
API_LEVEL=$API_LEVEL \
|
API_LEVEL=$API_LEVEL \
|
||||||
PROCESSOR=$PROCESSOR \
|
PROCESSOR=$PROCESSOR \
|
||||||
SYS_IMG=$SYS_IMG \
|
SYS_IMG=$SYS_IMG \
|
||||||
IMG_TYPE=$IMG_TYPE \
|
IMG_TYPE=$IMG_TYPE \
|
||||||
BROWSER=$BROWSER \
|
BROWSER=$BROWSER \
|
||||||
CHROME_DRIVER=2.40
|
CHROME_DRIVER=$CHROME_DRIVER
|
||||||
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
||||||
|
|
||||||
RUN yes | sdkmanager --licenses && \
|
RUN yes | sdkmanager --licenses && \
|
||||||
sdkmanager "platforms;android-${API_LEVEL}" "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" "emulator"
|
sdkmanager "platforms;android-${API_LEVEL}" "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" "emulator"
|
||||||
|
|
||||||
#==============================================
|
#==============================================
|
||||||
# Download latest version of chromedriver
|
# Download proper version of chromedriver
|
||||||
# to be able to use Chrome browser in emulator
|
# to be able to use Chrome browser in emulator
|
||||||
#==============================================
|
#==============================================
|
||||||
RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/${CHROME_DRIVER}/chromedriver_linux64.zip" \
|
RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/${CHROME_DRIVER}/chromedriver_linux64.zip" \
|
||||||
|
|||||||
+14
-3
@@ -31,6 +31,18 @@ declare -A list_of_levels=(
|
|||||||
[8.1]=27
|
[8.1]=27
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# The version of the Chrome browser installed on the Android emulator needs to be known beforehand
|
||||||
|
# in order to chose the proper version of chromedriver (see http://chromedriver.chromium.org/downloads)
|
||||||
|
declare -A chromedriver_versions=(
|
||||||
|
[5.0.1]="2.12"
|
||||||
|
[5.1.1]="2.13"
|
||||||
|
[6.0]="2.18"
|
||||||
|
[7.0]="2.23"
|
||||||
|
[7.1.1]="2.28"
|
||||||
|
[8.0]="2.31"
|
||||||
|
[8.1]="2.33"
|
||||||
|
)
|
||||||
|
|
||||||
function get_android_versions() {
|
function get_android_versions() {
|
||||||
versions=()
|
versions=()
|
||||||
|
|
||||||
@@ -57,9 +69,6 @@ function get_android_versions() {
|
|||||||
|
|
||||||
get_android_versions
|
get_android_versions
|
||||||
processor=x86
|
processor=x86
|
||||||
#chrome_driver=$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
|
|
||||||
#Reason: https://sites.google.com/a/chromium.org/chromedriver/downloads
|
|
||||||
chrome_driver=2.33
|
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
# Prepare needed parameter to run tests
|
# Prepare needed parameter to run tests
|
||||||
@@ -143,6 +152,8 @@ function build() {
|
|||||||
echo "[BUILD] API Level: $level"
|
echo "[BUILD] API Level: $level"
|
||||||
sys_img=$processor
|
sys_img=$processor
|
||||||
echo "[BUILD] System Image: $sys_img"
|
echo "[BUILD] System Image: $sys_img"
|
||||||
|
chrome_driver="${chromedriver_versions[$v]}"
|
||||||
|
echo "[BUILD] chromedriver version: $chrome_driver"
|
||||||
image_version="$IMAGE-$processor-$v:$RELEASE"
|
image_version="$IMAGE-$processor-$v:$RELEASE"
|
||||||
image_latest="$IMAGE-$processor-$v:latest"
|
image_latest="$IMAGE-$processor-$v:latest"
|
||||||
echo "[BUILD] Image name: $image_version and $image_latest"
|
echo "[BUILD] Image name: $image_version and $image_latest"
|
||||||
|
|||||||
+9
-6
@@ -4,6 +4,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import uuid
|
||||||
|
|
||||||
from src import CHROME_DRIVER, CONFIG_FILE, ROOT
|
from src import CHROME_DRIVER, CONFIG_FILE, ROOT
|
||||||
from src import log
|
from src import log
|
||||||
@@ -125,8 +126,7 @@ def appium_run(avd_name: str):
|
|||||||
cmd += ' --relaxed-security'
|
cmd += ' --relaxed-security'
|
||||||
|
|
||||||
default_web_browser = os.getenv('BROWSER')
|
default_web_browser = os.getenv('BROWSER')
|
||||||
if default_web_browser == 'chrome':
|
cmd += ' --chromedriver-executable {driver}'.format(driver=CHROME_DRIVER)
|
||||||
cmd += ' --chromedriver-executable {driver}'.format(driver=CHROME_DRIVER)
|
|
||||||
|
|
||||||
grid_connect = convert_str_to_bool(str(os.getenv('CONNECT_TO_GRID', False)))
|
grid_connect = convert_str_to_bool(str(os.getenv('CONNECT_TO_GRID', False)))
|
||||||
logger.info('Connect to selenium grid? {connect}'.format(connect=grid_connect))
|
logger.info('Connect to selenium grid? {connect}'.format(connect=grid_connect))
|
||||||
@@ -193,11 +193,14 @@ def run():
|
|||||||
"""Run app."""
|
"""Run app."""
|
||||||
device = os.getenv('DEVICE', 'Nexus 5')
|
device = os.getenv('DEVICE', 'Nexus 5')
|
||||||
logger.info('Device: {device}'.format(device=device))
|
logger.info('Device: {device}'.format(device=device))
|
||||||
|
device_id = os.getenv('DEVICE_ID', str(uuid.uuid4()))
|
||||||
|
logger.info('Device Id: {device_id}'.format(device_id=device_id))
|
||||||
|
|
||||||
avd_name = '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION)
|
avd_name = '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION)
|
||||||
logger.info('AVD name: {avd}'.format(avd=avd_name))
|
logger.info('AVD name: {avd}'.format(avd=avd_name))
|
||||||
|
is_first_run = not is_initialized()
|
||||||
|
|
||||||
if not is_initialized():
|
if is_first_run:
|
||||||
logger.info('Preparing emulator...')
|
logger.info('Preparing emulator...')
|
||||||
prepare_avd(device, avd_name)
|
prepare_avd(device, avd_name)
|
||||||
finish_initialization()
|
finish_initialization()
|
||||||
@@ -207,10 +210,10 @@ def run():
|
|||||||
with open("/root/android_emulator/config.ini", "a") as cfg:
|
with open("/root/android_emulator/config.ini", "a") as cfg:
|
||||||
cfg.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size))
|
cfg.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size))
|
||||||
|
|
||||||
if not is_initialized():
|
if is_first_run:
|
||||||
cmd = 'emulator/emulator @{name} -gpu off -verbose -wipe-data'.format(name=avd_name)
|
cmd = 'emulator/emulator @{name} -gpu off -prop emu.uuid={uuid} -verbose -wipe-data'.format(name=avd_name, uuid=device_id)
|
||||||
else:
|
else:
|
||||||
cmd = 'emulator/emulator @{name} -gpu off -verbose'.format(name=avd_name)
|
cmd = 'emulator/emulator @{name} -gpu off -prop emu.uuid={uuid} -verbose'.format(name=avd_name, uuid=device_id)
|
||||||
appium = convert_str_to_bool(str(os.getenv('APPIUM', False)))
|
appium = convert_str_to_bool(str(os.getenv('APPIUM', False)))
|
||||||
if appium:
|
if appium:
|
||||||
subprocess.Popen(cmd.split())
|
subprocess.Popen(cmd.split())
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
BOOT ()
|
||||||
|
{
|
||||||
|
A=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r')
|
||||||
|
while [[ $A != "1" ]]; do
|
||||||
|
sleep 1;
|
||||||
|
A=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r')
|
||||||
|
done;
|
||||||
|
}
|
||||||
|
|
||||||
|
Get_Google_Play_Services ()
|
||||||
|
{
|
||||||
|
wget "https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b51570a214a8/com.google.android.gms_12.8.74-040700-204998136_12874026_MinAPI23_(x86)(nodpi)_apklinker.com.apk"
|
||||||
|
}
|
||||||
|
|
||||||
|
Update_Google_Play_Services ()
|
||||||
|
{
|
||||||
|
adb install -r "$PWD/com.google.android.gms_12.8.74-040700-204998136_12874026_MinAPI23_(x86)(nodpi)_apklinker.com.apk"
|
||||||
|
}
|
||||||
|
Disable_animations ()
|
||||||
|
{
|
||||||
|
# this is for demonstration what other amazing staff can be done here
|
||||||
|
adb shell "settings put global window_animation_scale 0.0"
|
||||||
|
adb shell "settings put global transition_animation_scale 0.0"
|
||||||
|
adb shell "settings put global animator_duration_scale 0.0"
|
||||||
|
}
|
||||||
|
BOOT
|
||||||
|
Get_Google_Play_Services
|
||||||
|
Update_Google_Play_Services
|
||||||
|
Disable_animations
|
||||||
@@ -55,3 +55,10 @@ autorestart=false
|
|||||||
stdout_logfile=%(ENV_LOG_PATH)s/video-recording.stdout.log
|
stdout_logfile=%(ENV_LOG_PATH)s/video-recording.stdout.log
|
||||||
stderr_logfile=%(ENV_LOG_PATH)s/video-recording.stderr.log
|
stderr_logfile=%(ENV_LOG_PATH)s/video-recording.stderr.log
|
||||||
priority=4
|
priority=4
|
||||||
|
|
||||||
|
[program:adb-utils]
|
||||||
|
command=./src/utils.sh
|
||||||
|
autorestart=false
|
||||||
|
stdout_logfile=%(ENV_LOG_PATH)s/adb-utils.stdout.log
|
||||||
|
stderr_logfile=%(ENV_LOG_PATH)s/adb-utils.stderr.log
|
||||||
|
priority=5
|
||||||
|
|||||||
Reference in New Issue
Block a user