|
@@ -1,222 +1,132 @@
|
|
|
-FROM appium/appium:1.16.0-p1
|
|
|
+FROM ubuntu:18.04
|
|
|
|
|
|
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
|
|
|
+RUN echo "Europe/Rome" > /etc/timezone
|
|
|
|
|
|
-#======================
|
|
|
-# Add Emulator Devices
|
|
|
-#======================
|
|
|
-COPY devices /root/devices
|
|
|
+RUN apt-get update -q && \
|
|
|
+ export DEBIAN_FRONTEND=noninteractive && \
|
|
|
+ apt-get install -y --no-install-recommends tzdata
|
|
|
|
|
|
-# ================================
|
|
|
-# Add everything needed for baangt
|
|
|
-# ================================
|
|
|
+RUN dpkg-reconfigure -f noninteractive tzdata
|
|
|
|
|
|
-RUN export DEBIAN_FRONTEND=noninteractive && \
|
|
|
+# Install packages
|
|
|
+RUN apt-get update -q && \
|
|
|
+ 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 python3-setuptools python3-tk && \
|
|
|
+ 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 python-pip python3.7-dev python-qt4 python3-pip tk-dev && \
|
|
|
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 install -y cpu-checker openjdk-8-jdk libglu1 libpulse-dev libasound2 libc6 \
|
|
|
+ libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxi6 libxtst6 libnss3
|
|
|
|
|
|
-WORKDIR /
|
|
|
# Install Baangt
|
|
|
-RUN git clone -b Appium https://gogs.earthsquad.global/athos/baangt --single-branch && \
|
|
|
+RUN git clone -b master https://gogs.earthsquad.global/athos/baangt --single-branch && \
|
|
|
pip3 install -r baangt/requirements.txt
|
|
|
|
|
|
-# Download Browser Drivers:
|
|
|
+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/
|
|
|
+RUN chmod a+x /root/start-vncserver.sh && \
|
|
|
+ chmod a+x /root/baangt.sh && \
|
|
|
+ echo "mycontainer" > /etc/hostname && \
|
|
|
+ echo "127.0.0.1 localhost" > /etc/hosts && \
|
|
|
+ echo "127.0.0.1 mycontainer" >> /etc/hosts
|
|
|
+
|
|
|
WORKDIR /baangt
|
|
|
RUN mkdir /baangt/browserDrivers
|
|
|
RUN python3 baangt.py --reloadDrivers=True
|
|
|
|
|
|
+EXPOSE 5901
|
|
|
+ENV USER root
|
|
|
+CMD [ "/root/start-vncserver.sh" ]
|
|
|
|
|
|
-#===================
|
|
|
-# Run docker-appium
|
|
|
-#===================
|
|
|
-WORKDIR /root
|
|
|
-COPY src /root/src
|
|
|
-COPY supervisord.conf /root/
|
|
|
-RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
|
|
+#===============
|
|
|
+# Expose Ports
|
|
|
+#---------------
|
|
|
+# 4723
|
|
|
+# Appium port
|
|
|
+# 5554
|
|
|
+# Emulator port
|
|
|
+# 5555
|
|
|
+# ADB connection port
|
|
|
+#===============
|
|
|
+EXPOSE 4723 5554 5555
|
|
|
|
|
|
-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'
|
|
|
+# ===============================================================================
|
|
|
+# Alternative emulator installation from android-container Dockerfile from google
|
|
|
+# ===============================================================================
|
|
|
+WORKDIR /
|
|
|
|
|
|
-CMD /usr/bin/supervisord --configuration supervisord.conf
|
|
|
+# gradle
|
|
|
+ENV GRADLE_USER_HOME=/cache
|
|
|
+VOLUME $GRADLE_USER_HOME
|
|
|
+
|
|
|
+# android
|
|
|
+ARG ANDROID_EMULATOR_PACKAGE_ARM="system-images;android-25;google_apis;armeabi-v7a"
|
|
|
+ARG ANDROID_EMULATOR_PACKAGE_x86="system-images;android-R;google_apis;x86"
|
|
|
+ARG ANDROID_PLATFORM_VERSION="platforms;android-R"
|
|
|
+ARG ANDROID_SDK_VERSION="sdk-tools-linux-4333796.zip"
|
|
|
+ARG ANDROID_SDK_PACKAGES="${ANDROID_EMULATOR_PACKAGE_ARM} ${ANDROID_EMULATOR_PACKAGE_x86} ${ANDROID_PLATFORM_VERSION} platform-tools emulator"
|
|
|
+
|
|
|
+RUN wget https://dl.google.com/android/repository/${ANDROID_SDK_VERSION} -P /tmp && \
|
|
|
+ unzip -d /opt/android /tmp/${ANDROID_SDK_VERSION}
|
|
|
+ENV ANDROID_HOME=/opt/android
|
|
|
+ENV PATH "$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools"
|
|
|
+
|
|
|
+# sdkmanager
|
|
|
+RUN mkdir /root/.android/
|
|
|
+RUN touch /root/.android/repositories.cfg
|
|
|
+# This is to create an empty auth_token file, so that he doesn't bother me with password for Telnet requests
|
|
|
+RUN touch /root/.android/.emulator_console_auth_token
|
|
|
+RUN yes Y | sdkmanager --licenses
|
|
|
+RUN yes Y | sdkmanager --verbose --no_https ${ANDROID_SDK_PACKAGES}
|
|
|
+
|
|
|
+# avdmanager
|
|
|
+ENV GRADLE_VERSION=5.4.1
|
|
|
+ENV ANDROID_API_LEVEL=28
|
|
|
+ENV ANDROID_BUILD_TOOLS_LEVEL=28.0.3
|
|
|
+ENV EMULATOR_NAME=test
|
|
|
+
|
|
|
+ENV EMULATOR_NAME_x86="android_x86"
|
|
|
+ENV EMULATOR_NAME_ARM="android_arm"
|
|
|
+RUN echo "no" | avdmanager --verbose create avd --force --name "${EMULATOR_NAME_x86}" --device "pixel" --package "${ANDROID_EMULATOR_PACKAGE_x86}"
|
|
|
+RUN echo "no" | avdmanager --verbose create avd --force --name "${EMULATOR_NAME_ARM}" --device "pixel" --package "${ANDROID_EMULATOR_PACKAGE_ARM}"
|
|
|
+ENV LD_LIBRARY_PATH "$ANDROID_HOME/emulator/lib64:$ANDROID_HOME/emulator/lib64/qt/lib"
|
|
|
+
|
|
|
+ADD start.sh /
|
|
|
+RUN chmod +x start.sh
|
|
|
+
|
|
|
+# Now install appium
|
|
|
+RUN apt-get install -y --no-install-recommends npm nodejs
|
|
|
+RUN node install appium
|
|
|
+RUN npm install utf-8-validate bufferutil
|
|
|
+RUN npm install -g appium
|
|
|
+
|
|
|
+# Workaround for wrong baangt checkout
|
|
|
+WORKDIR /baangt
|
|
|
+RUN git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
|
|
+RUN git fetch origin
|
|
|
+RUN git checkout Appium
|
|
|
+RUN pip3 install -r requirements.txt
|
|
|
+
|
|
|
+EXPOSE 5901
|
|
|
+ENV USER root
|
|
|
+CMD [ "/root/start-vncserver.sh" ]
|