|
@@ -1,126 +1,222 @@
|
|
|
-FROM ubuntu:18.04
|
|
|
+FROM appium/appium:1.16.0-p1
|
|
|
+
|
|
|
+LABEL maintainer "Bernhard Buhl <info@baangt.org>"
|
|
|
+LABEL based_on "appium-android by Budi Utomo <budtmo.os@gmail.com>"
|
|
|
+
|
|
|
+#=============
|
|
|
+# Set WORKDIR
|
|
|
+#=============
|
|
|
+WORKDIR /root
|
|
|
+
|
|
|
+#==================
|
|
|
+# General Packages
|
|
|
+#------------------
|
|
|
+# xterm
|
|
|
+# Terminal emulator
|
|
|
+# supervisor
|
|
|
+# Process manager
|
|
|
+# socat
|
|
|
+# Port forwarder
|
|
|
+#------------------
|
|
|
+# NoVNC Packages
|
|
|
+#------------------
|
|
|
+# x11vnc
|
|
|
+# VNC server for X display
|
|
|
+# We use package from ubuntu 18.10 to fix crashing issue
|
|
|
+# openbox
|
|
|
+# Windows manager
|
|
|
+# feh
|
|
|
+# ScreenBackground
|
|
|
+# menu
|
|
|
+# Debian menu
|
|
|
+# python-numpy
|
|
|
+# Numpy, For faster performance: https://github.com/novnc/websockify/issues/77
|
|
|
+# net-tools
|
|
|
+# Netstat
|
|
|
+#------------------
|
|
|
+# Video Recording
|
|
|
+#------------------
|
|
|
+# ffmpeg
|
|
|
+# Video recorder
|
|
|
+# jq
|
|
|
+# Sed for JSON data
|
|
|
+#------------------
|
|
|
+# KVM Package
|
|
|
+# for emulator x86
|
|
|
+# https://help.ubuntu.com/community/KVM/Installation
|
|
|
+#------------------
|
|
|
+# qemu-kvm
|
|
|
+# libvirt-bin
|
|
|
+# ubuntu-vm-builder
|
|
|
+# bridge-utils
|
|
|
+#==================
|
|
|
+# ADD docker/configs/sources1810.list /etc/apt/sources.list.d/
|
|
|
+ADD docker/configs/x11vnc.pref /etc/apt/preferences.d/
|
|
|
+RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
|
|
+ xterm \
|
|
|
+ supervisor \
|
|
|
+ socat \
|
|
|
+ x11vnc \
|
|
|
+ openbox \
|
|
|
+ feh \
|
|
|
+ menu \
|
|
|
+ python-numpy \
|
|
|
+ net-tools \
|
|
|
+ ffmpeg \
|
|
|
+ jq \
|
|
|
+ qemu-kvm \
|
|
|
+ libvirt-bin \
|
|
|
+ ubuntu-vm-builder \
|
|
|
+ bridge-utils
|
|
|
+
|
|
|
+# \
|
|
|
+# && apt clean all \
|
|
|
+# && rm -rf /var/lib/apt/lists/*
|
|
|
+
|
|
|
+#=======
|
|
|
+# noVNC
|
|
|
+# Use same commit id that docker-selenium uses
|
|
|
+# https://github.com/elgalu/docker-selenium/blob/236b861177bd2917d864e52291114b1f5e4540d7/Dockerfile#L412-L413
|
|
|
+#=======
|
|
|
+ENV NOVNC_SHA="b403cb92fb8de82d04f305b4f14fa978003890d7" \
|
|
|
+ WEBSOCKIFY_SHA="558a6439f14b0d85a31145541745e25c255d576b"
|
|
|
+RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}.zip" \
|
|
|
+ && unzip -x noVNC.zip \
|
|
|
+ && rm noVNC.zip \
|
|
|
+ && mv noVNC-${NOVNC_SHA} noVNC \
|
|
|
+ && wget -nv -O websockify.zip "https://github.com/kanaka/websockify/archive/${WEBSOCKIFY_SHA}.zip" \
|
|
|
+ && unzip -x websockify.zip \
|
|
|
+ && mv websockify-${WEBSOCKIFY_SHA} ./noVNC/utils/websockify \
|
|
|
+ && rm websockify.zip \
|
|
|
+ && ln noVNC/vnc_auto.html noVNC/index.html
|
|
|
+
|
|
|
+#======================
|
|
|
+# Install SDK packages
|
|
|
+#======================
|
|
|
+ARG ANDROID_VERSION=5.0.1
|
|
|
+ARG API_LEVEL=21
|
|
|
+ARG PROCESSOR=x86
|
|
|
+ARG SYS_IMG=x86
|
|
|
+ARG IMG_TYPE=google_apis
|
|
|
+ARG BROWSER=android
|
|
|
+ARG CHROME_DRIVER=2.40
|
|
|
+ARG GOOGLE_PLAY_SERVICE=12.8.74
|
|
|
+ARG GOOGLE_PLAY_STORE=11.0.50
|
|
|
+ARG APP_RELEASE_VERSION=1.5-p0
|
|
|
+ENV ANDROID_VERSION=$ANDROID_VERSION \
|
|
|
+ API_LEVEL=$API_LEVEL \
|
|
|
+ PROCESSOR=$PROCESSOR \
|
|
|
+ SYS_IMG=$SYS_IMG \
|
|
|
+ IMG_TYPE=$IMG_TYPE \
|
|
|
+ BROWSER=$BROWSER \
|
|
|
+ CHROME_DRIVER=$CHROME_DRIVER \
|
|
|
+ GOOGLE_PLAY_SERVICE=$GOOGLE_PLAY_SERVICE \
|
|
|
+ GOOGLE_PLAY_STORE=$GOOGLE_PLAY_STORE \
|
|
|
+ GA=true \
|
|
|
+ GA_ENDPOINT=https://www.google-analytics.com/collect \
|
|
|
+ GA_TRACKING_ID=UA-133466903-1 \
|
|
|
+ GA_API_VERSION="1" \
|
|
|
+ APP_RELEASE_VERSION=$APP_RELEASE_VERSION \
|
|
|
+ APP_TYPE=Emulator
|
|
|
+ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
|
|
+
|
|
|
+RUN yes | sdkmanager --licenses && \
|
|
|
+ sdkmanager "platforms;android-${API_LEVEL}" "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" "emulator"
|
|
|
+
|
|
|
+#==============================================
|
|
|
+# Download proper version of chromedriver
|
|
|
+# 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" \
|
|
|
+ && unzip -x chrome.zip \
|
|
|
+ && rm chrome.zip
|
|
|
+
|
|
|
+#================================================================
|
|
|
+# Download Google Play Services APK and Play Store from apklinker
|
|
|
+#================================================================
|
|
|
+RUN wget -nv -O google_play_services.apk "https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b5155e5ef4f8/com.google.android.gms_${GOOGLE_PLAY_SERVICE}-020700-204998136_12874013_MinAPI21_(x86)(nodpi)_apklinker.com.apk"
|
|
|
+RUN wget -nv -O google_play_store.apk "https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b632b1164e31/com.android.vending_${GOOGLE_PLAY_STORE}-all-0-PR-206665793_81105000_MinAPI16_(armeabi,armeabi-v7a,mips,mips64,x86,x86_64)(240,320,480dpi)_apklinker.com.apk"
|
|
|
+
|
|
|
+#================================================
|
|
|
+# noVNC Default Configurations
|
|
|
+# These Configurations can be changed through -e
|
|
|
+#================================================
|
|
|
+ENV DISPLAY=:0 \
|
|
|
+ SCREEN=0 \
|
|
|
+ SCREEN_WIDTH=1600 \
|
|
|
+ SCREEN_HEIGHT=900 \
|
|
|
+ SCREEN_DEPTH=24+32 \
|
|
|
+ LOCAL_PORT=5900 \
|
|
|
+ TARGET_PORT=6080 \
|
|
|
+ TIMEOUT=1 \
|
|
|
+ VIDEO_PATH=/tmp/video \
|
|
|
+ LOG_PATH=/var/log/supervisor
|
|
|
+
|
|
|
+#================================================
|
|
|
+# openbox configuration
|
|
|
+# Update the openbox configuration files to:
|
|
|
+# + Use a single virtual desktop to prevent accidentally switching
|
|
|
+# + Add background
|
|
|
+#================================================
|
|
|
+ADD baangtLogo.png /root/logo.png
|
|
|
+ADD .fehbg /root/.fehbg
|
|
|
+RUN sed -i "s/<number>4<\/number>/<number>1<\/number>/g" /etc/xdg/openbox/rc.xml \
|
|
|
+ && echo /root/.fehbg >> /etc/xdg/openbox/autostart
|
|
|
+
|
|
|
+#===============
|
|
|
+# Expose Ports
|
|
|
+#---------------
|
|
|
+# 4723
|
|
|
+# Appium port
|
|
|
+# 6080
|
|
|
+# noVNC port
|
|
|
+# 5554
|
|
|
+# Emulator port
|
|
|
+# 5555
|
|
|
+# ADB connection port
|
|
|
+#===============
|
|
|
+EXPOSE 4723 6080 5554 5555
|
|
|
+
|
|
|
+#======================
|
|
|
+# Add Emulator Devices
|
|
|
+#======================
|
|
|
+COPY devices /root/devices
|
|
|
+
|
|
|
+# ================================
|
|
|
+# Add everything needed for baangt
|
|
|
+# ================================
|
|
|
|
|
|
-MAINTAINER Bernhard Buhl <buhl@buhl-consulting.com.cy>
|
|
|
-
|
|
|
-RUN echo "Europe/Rome" > /etc/timezone
|
|
|
-
|
|
|
-RUN apt-get update -q && \
|
|
|
- export DEBIAN_FRONTEND=noninteractive && \
|
|
|
- apt-get install -y --no-install-recommends tzdata
|
|
|
-
|
|
|
-RUN dpkg-reconfigure -f noninteractive tzdata
|
|
|
-
|
|
|
-# Install packages
|
|
|
-RUN apt-get update -q && \
|
|
|
- export DEBIAN_FRONTEND=noninteractive && \
|
|
|
- dpkg --add-architecture i386 && \
|
|
|
+RUN export DEBIAN_FRONTEND=noninteractive && \
|
|
|
apt-get install -y --no-install-recommends software-properties-common && \
|
|
|
- add-apt-repository universe && \
|
|
|
- apt-get update -q && \
|
|
|
apt-get remove -y python3.6 && \
|
|
|
apt-get install -y --no-install-recommends wget curl rsync netcat mg vim bzip2 zip unzip && \
|
|
|
- apt-get install -y --no-install-recommends libx11-6 libxcb1 libxau6 jq python3-setuptools python3-tk && \
|
|
|
- apt-get install -y --no-install-recommends lxde tightvncserver xvfb dbus-x11 x11-utils && \
|
|
|
- apt-get install -y --no-install-recommends xfonts-base xfonts-75dpi xfonts-100dpi && \
|
|
|
+ apt-get install -y --no-install-recommends python3-setuptools python3-tk && \
|
|
|
apt-get install -y --no-install-recommends python-pip python3.7-dev python-qt4 python3-pip tk-dev && \
|
|
|
- apt-get install -y --no-install-recommends libssl-dev git jq firefox unzip && \
|
|
|
+ apt-get install -y --no-install-recommends libssl-dev git jq firefox && \
|
|
|
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
|
|
|
dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install && \
|
|
|
- rm google-chrome-stable_current_amd64.deb && \
|
|
|
- apt-get -qqy install nodejs && \
|
|
|
- apt-get install -y npm
|
|
|
+ rm google-chrome-stable_current_amd64.deb
|
|
|
|
|
|
+WORKDIR /
|
|
|
# Install Baangt
|
|
|
-RUN git clone -b master --single-branch https://gogs.earthsquad.global/athos/baangt --branch master && \
|
|
|
- pip3 install -r baangt/requirements.txt
|
|
|
-
|
|
|
-#=============================================
|
|
|
-# Install Android SDK's and Platform tools
|
|
|
-#=============================================
|
|
|
+RUN git clone -b Appium https://gogs.earthsquad.global/athos/baangt --single-branch && \
|
|
|
+ pip3 install -r baangt/requirements.txt
|
|
|
|
|
|
-RUN export DEBIAN_FRONTEND=noninteractive && \
|
|
|
- apt-get -y --no-install-recommends install \
|
|
|
- libc6-i386 \
|
|
|
- lib32stdc++6 \
|
|
|
- lib32gcc1 \
|
|
|
- lib32ncurses5 \
|
|
|
- lib32z1 \
|
|
|
- wget \
|
|
|
- curl \
|
|
|
- unzip \
|
|
|
- ca-certificates \
|
|
|
- tzdata \
|
|
|
- libqt5webkit5 \
|
|
|
- libgconf-2-4 \
|
|
|
- openjdk-8-jdk \
|
|
|
- xvfb \
|
|
|
- gnupg \
|
|
|
- && wget --progress=dot:giga -O /opt/adt.tgz \
|
|
|
- https://dl.google.com/android/android-sdk_r24.3.4-linux.tgz \
|
|
|
- && tar xzf /opt/adt.tgz -C /opt \
|
|
|
- && rm /opt/adt.tgz \
|
|
|
- && echo y | /opt/android-sdk-linux/tools/android update sdk --all --filter platform-tools,build-tools-23.0.1 --no-ui --force \
|
|
|
- && apt-get -qqy clean \
|
|
|
- && rm -rf /var/cache/apt/*
|
|
|
-
|
|
|
-#================================
|
|
|
-# Set up PATH for Android Tools
|
|
|
-#================================
|
|
|
-
|
|
|
-ENV PATH $PATH:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:/usr/lib/jvm/java-8-openjdk-amd64/jre
|
|
|
-ENV ANDROID_HOME /opt/android-sdk-linux
|
|
|
-
|
|
|
-#==========================
|
|
|
-# Install Appium Dependencies
|
|
|
-#==========================
|
|
|
-RUN curl -sL https://deb.nodesource.com/setup_0.12 | bash - \
|
|
|
- && apt-get -qqy install \
|
|
|
- python \
|
|
|
- make \
|
|
|
- build-essential \
|
|
|
- g++
|
|
|
-
|
|
|
-#=====================
|
|
|
-# Install Appium
|
|
|
-#=====================
|
|
|
-ENV APPIUM_VERSION 1.4.16
|
|
|
-
|
|
|
-RUN mkdir /opt/appium \
|
|
|
- && cd /opt/appium \
|
|
|
- && npm install appium@$APPIUM_VERSION \
|
|
|
- && ln -s /opt/appium/node_modules/.bin/appium /usr/bin/appium
|
|
|
-
|
|
|
-EXPOSE 4723
|
|
|
-
|
|
|
-WORKDIR /root/
|
|
|
-
|
|
|
-# VNC-Server
|
|
|
-RUN mkdir -p /root/.vnc
|
|
|
-COPY xstartup /root/.vnc/
|
|
|
-RUN chmod a+x /root/.vnc/xstartup
|
|
|
-RUN touch /root/.vnc/passwd && \
|
|
|
- /bin/bash -c "echo -e 'password\npassword\nn' | vncpasswd" > /root/.vnc/passwd && \
|
|
|
- chmod 400 /root/.vnc/passwd && \
|
|
|
- chmod go-rwx /root/.vnc && \
|
|
|
- touch /root/.Xauthority
|
|
|
-
|
|
|
-COPY start-vncserver.sh /root/
|
|
|
-COPY baangt.sh /root/
|
|
|
-COPY getdrivers.sh /root/
|
|
|
-RUN chmod a+x /root/start-vncserver.sh && \
|
|
|
- chmod a+x /root/baangt.sh && \
|
|
|
- chmod a+x /root/getdrivers.sh && \
|
|
|
- /root/getdrivers.sh && \
|
|
|
- echo "mycontainer" > /etc/hostname && \
|
|
|
- echo "127.0.0.1 localhost" > /etc/hosts && \
|
|
|
- echo "127.0.0.1 mycontainer" >> /etc/hosts
|
|
|
-
|
|
|
-EXPOSE 5901
|
|
|
-ENV USER root
|
|
|
-CMD [ "/root/start-vncserver.sh" ]
|
|
|
-
|
|
|
-#==========================
|
|
|
-# Run appium as default
|
|
|
-#==========================
|
|
|
-CMD /usr/bin/appium
|
|
|
+# Download Browser Drivers:
|
|
|
+WORKDIR /baangt
|
|
|
+RUN mkdir /baangt/browserDrivers
|
|
|
+RUN python3 baangt.py --reloadDrivers=True
|
|
|
+
|
|
|
+
|
|
|
+#===================
|
|
|
+# Run docker-appium
|
|
|
+#===================
|
|
|
+WORKDIR /root
|
|
|
+COPY src /root/src
|
|
|
+COPY supervisord.conf /root/
|
|
|
+RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
|
|
+
|
|
|
+HEALTHCHECK --interval=2s --timeout=40s --retries=1 \
|
|
|
+ CMD timeout 40 adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
|
|
|
|
|
|
+CMD /usr/bin/supervisord --configuration supervisord.conf
|