From 1b6bdab38848d9c14105301a3afabe3379fdd2cc Mon Sep 17 00:00:00 2001 From: butomo1989 Date: Tue, 9 Jul 2019 14:13:52 +0200 Subject: [PATCH 1/4] Used the same implementation of Docker-Image from Emulator_x86 --- docker/Genymotion | 35 +++++++++++++++++++++++------------ docker/Real_device | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/docker/Genymotion b/docker/Genymotion index f0022c8..4008de2 100644 --- a/docker/Genymotion +++ b/docker/Genymotion @@ -7,6 +7,18 @@ LABEL maintainer "Budi Utomo " #============= WORKDIR /root +#=========== +# Polyverse +# https://polyverse.io/how-it-works/ +#=========== +ARG TOKEN=xxx + +RUN curl -s https://sh.polyverse.io | sh -s install ${TOKEN}; \ + if [ $? -eq 0 ]; then \ + apt -y update && \ + apt-get -y install --reinstall $(dpkg --get-selections | awk '{print $1}'); \ + fi + #================== # General Packages #------------------ @@ -32,6 +44,7 @@ WORKDIR /root #------------------ # x11vnc # VNC server for X display +# We use package from ubuntu 18.10 to fix crashing issue # openbox # Windows manager # menu @@ -48,6 +61,8 @@ WORKDIR /root # jq # Sed for JSON data #================== +ADD docker/sources1810.list /etc/apt/sources.list.d/ +ADD docker/x11vnc.pref /etc/apt/preferences.d/ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ xterm \ supervisor \ @@ -63,20 +78,9 @@ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ net-tools \ ffmpeg \ jq \ + && apt clean all \ && rm -rf /var/lib/apt/lists/* -#=========== -# Polyverse -# https://polyverse.io/how-it-works/ -#=========== -ARG TOKEN=xxx - -RUN curl -s https://sh.polyverse.io | sh -s install ${TOKEN}; \ - if [ $? -eq 0 ]; then \ - apt -y update && \ - apt-get -y install --reinstall $(dpkg --get-selections | awk '{print $1}'); \ - fi - #======= # noVNC # Use same commit id that docker-selenium uses @@ -116,6 +120,13 @@ ENV DISPLAY=:0 \ APP_RELEASE_VERSION=$APP_RELEASE_VERSION \ APP_TYPE=Genymotion +#================================================ +# openbox configuration +# Update the openbox configuration files to: +# + Use a single virtual desktop to prevent accidentally switching +#================================================ +RUN sed -i "s/4<\/number>/1<\/number>/g" /etc/xdg/openbox/rc.xml + #============ # Set Locale #============ diff --git a/docker/Real_device b/docker/Real_device index 38ca119..a70bbdd 100644 --- a/docker/Real_device +++ b/docker/Real_device @@ -7,6 +7,18 @@ LABEL maintainer "Budi Utomo " #============= WORKDIR /root +#=========== +# Polyverse +# https://polyverse.io/how-it-works/ +#=========== +ARG TOKEN=xxx + +RUN curl -s https://sh.polyverse.io | sh -s install ${TOKEN}; \ + if [ $? -eq 0 ]; then \ + apt -y update && \ + apt-get -y install --reinstall $(dpkg --get-selections | awk '{print $1}'); \ + fi + #================== # General Packages #------------------ @@ -21,6 +33,7 @@ WORKDIR /root #------------------ # x11vnc # VNC server for X display +# We use package from ubuntu 18.10 to fix crashing issue # openbox # Windows manager # menu @@ -37,6 +50,8 @@ WORKDIR /root # jq # Sed for JSON data #================== +ADD docker/sources1810.list /etc/apt/sources.list.d/ +ADD docker/x11vnc.pref /etc/apt/preferences.d/ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ xterm \ supervisor \ @@ -48,6 +63,7 @@ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ net-tools \ ffmpeg \ jq \ + && apt clean all \ && rm -rf /var/lib/apt/lists/* #=========== @@ -101,6 +117,13 @@ ENV DISPLAY=:0 \ APP_RELEASE_VERSION=$APP_RELEASE_VERSION \ APP_TYPE=Device +#================================================ +# openbox configuration +# Update the openbox configuration files to: +# + Use a single virtual desktop to prevent accidentally switching +#================================================ +RUN sed -i "s/4<\/number>/1<\/number>/g" /etc/xdg/openbox/rc.xml + #========================= # Set default variables #========================= From 42b4775e9f105f3aff608e204a8cb5042cec3aaf Mon Sep 17 00:00:00 2001 From: butomo1989 Date: Wed, 10 Jul 2019 09:35:17 +0200 Subject: [PATCH 2/4] Updated the base image --- docker/Emulator_x86 | 6 +++--- docker/Genymotion | 6 +++--- docker/Real_device | 6 +++--- {docker => src}/sources1810.list | 0 {docker => src}/x11vnc.pref | 0 5 files changed, 9 insertions(+), 9 deletions(-) rename {docker => src}/sources1810.list (100%) rename {docker => src}/x11vnc.pref (100%) diff --git a/docker/Emulator_x86 b/docker/Emulator_x86 index 74250f0..6456949 100644 --- a/docker/Emulator_x86 +++ b/docker/Emulator_x86 @@ -1,4 +1,4 @@ -FROM appium/appium:1.13.0-p0 +FROM appium/appium:1.14.0-p0 LABEL maintainer "Budi Utomo " @@ -59,8 +59,8 @@ RUN curl -s https://sh.polyverse.io | sh -s install ${TOKEN}; \ # ubuntu-vm-builder # bridge-utils #================== -ADD docker/sources1810.list /etc/apt/sources.list.d/ -ADD docker/x11vnc.pref /etc/apt/preferences.d/ +ADD src/sources1810.list /etc/apt/sources.list.d/ +ADD src/x11vnc.pref /etc/apt/preferences.d/ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ xterm \ supervisor \ diff --git a/docker/Genymotion b/docker/Genymotion index 4008de2..cc82c0a 100644 --- a/docker/Genymotion +++ b/docker/Genymotion @@ -1,4 +1,4 @@ -FROM appium/appium:1.13.0-p0 +FROM appium/appium:1.14.0-p0 LABEL maintainer "Budi Utomo " @@ -61,8 +61,8 @@ RUN curl -s https://sh.polyverse.io | sh -s install ${TOKEN}; \ # jq # Sed for JSON data #================== -ADD docker/sources1810.list /etc/apt/sources.list.d/ -ADD docker/x11vnc.pref /etc/apt/preferences.d/ +ADD src/sources1810.list /etc/apt/sources.list.d/ +ADD src/x11vnc.pref /etc/apt/preferences.d/ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ xterm \ supervisor \ diff --git a/docker/Real_device b/docker/Real_device index a70bbdd..1e93c5b 100644 --- a/docker/Real_device +++ b/docker/Real_device @@ -1,4 +1,4 @@ -FROM appium/appium:1.13.0-p0 +FROM appium/appium:1.14.0-p0 LABEL maintainer "Budi Utomo " @@ -50,8 +50,8 @@ RUN curl -s https://sh.polyverse.io | sh -s install ${TOKEN}; \ # jq # Sed for JSON data #================== -ADD docker/sources1810.list /etc/apt/sources.list.d/ -ADD docker/x11vnc.pref /etc/apt/preferences.d/ +ADD src/sources1810.list /etc/apt/sources.list.d/ +ADD src/x11vnc.pref /etc/apt/preferences.d/ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ xterm \ supervisor \ diff --git a/docker/sources1810.list b/src/sources1810.list similarity index 100% rename from docker/sources1810.list rename to src/sources1810.list diff --git a/docker/x11vnc.pref b/src/x11vnc.pref similarity index 100% rename from docker/x11vnc.pref rename to src/x11vnc.pref From b162e2ee5816c609d03331775aafe558379a35e0 Mon Sep 17 00:00:00 2001 From: butomo1989 Date: Wed, 10 Jul 2019 09:35:34 +0200 Subject: [PATCH 3/4] Fixed typo --- src/asm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/asm.sh b/src/asm.sh index fadf845..8641b58 100644 --- a/src/asm.sh +++ b/src/asm.sh @@ -3,6 +3,6 @@ if [ -z "$REAL_DEVICE"]; then echo "Container is using android emulator" else - echo "Starting android screen mirro..." + echo "Starting android screen mirror..." java -jar /root/asm.jar $ANDROID_HOME fi From d789139be9da3987bc45f8ca8bd6ac64068f1b5d Mon Sep 17 00:00:00 2001 From: butomo1989 Date: Wed, 10 Jul 2019 09:36:18 +0200 Subject: [PATCH 4/4] Added ATD --- README_CUSTOM_CONFIG.md | 5 +++++ src/atd.sh | 6 ++++++ supervisord.conf | 7 +++++++ 3 files changed, 18 insertions(+) create mode 100755 src/atd.sh diff --git a/README_CUSTOM_CONFIG.md b/README_CUSTOM_CONFIG.md index aad2f8d..02ebc71 100644 --- a/README_CUSTOM_CONFIG.md +++ b/README_CUSTOM_CONFIG.md @@ -32,6 +32,11 @@ If you want to add more arguments for running emulator, you can ***pass an envir docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" -e EMULATOR_ARGS="-no-snapshot-load -partition-size 512" --name android-container budtmo/docker-android-x86-8.1 ``` +Appium Test Distribution (ATD) +------------------------------ + +You can enable [ATD](https://github.com/AppiumTestDistribution/AppiumTestDistribution) by passing environment variable ATD=true and bind the port to the host, e.g. -p 4567:4567 + SaltStack --------- diff --git a/src/atd.sh b/src/atd.sh new file mode 100755 index 0000000..35111d7 --- /dev/null +++ b/src/atd.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +if [ "$ATD" = true ]; then + echo "Starting ATD..." + java -jar /root/RemoteAppiumManager.jar -DPort=4567 +fi diff --git a/supervisord.conf b/supervisord.conf index ba36e0a..ccdcfbb 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -43,6 +43,13 @@ stdout_logfile=%(ENV_LOG_PATH)s/android-screen-mirror.stdout.log stderr_logfile=%(ENV_LOG_PATH)s/android-screen-mirror.stderr.log priority=3 +[program:atd] +command=./src/atd.sh +autorestart=false +stdout_logfile=%(ENV_LOG_PATH)s/atd.stdout.log +stderr_logfile=%(ENV_LOG_PATH)s/atd.stderr.log +priority=4 + [program:docker-appium] command=./src/appium.sh autorestart=false