Using docker-appium as base image

This commit is contained in:
butomo1989 2017-06-14 15:00:54 +02:00
parent 5b694c2c55
commit 65df456066
2 changed files with 23 additions and 97 deletions

View file

@ -1,6 +1,6 @@
FROM ubuntu:16.04 FROM appium/appium:1.6.6-beta-p0
ENV DEBIAN_FRONTEND noninteractive LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
#============= #=============
# Set WORKDIR # Set WORKDIR
@ -10,29 +10,15 @@ WORKDIR /root
#================== #==================
# General Packages # General Packages
#------------------ #------------------
# wget
# Network downloader
# unzip
# Unzip zip file
# curl
# Transfer data from or to a server
# xterm # xterm
# Terminal emulator # Terminal emulator
# supervisor # supervisor
# Process manager # Process manager
# openjdk-8-jdk
# Java
# libqt5webkit5
# Web content engine (Fix issue in Android)
# socat # socat
# Port forwarder # Port forwarder
# libgconf-2-4
# Required package for chrome and chromedriver to run on Linux
#------------------ #------------------
# NoVNC Packages # NoVNC Packages
#------------------ #------------------
# xvfb
# X virtual framebuffer
# x11vnc # x11vnc
# VNC server for X display # VNC server for X display
# openbox # openbox
@ -45,16 +31,9 @@ WORKDIR /root
# Netstat # Netstat
#================== #==================
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
wget \
unzip \
curl \
xterm \ xterm \
supervisor \ supervisor \
openjdk-8-jdk \
libqt5webkit5 \
socat \ socat \
libgconf-2-4 \
xvfb \
x11vnc \ x11vnc \
openbox \ openbox \
menu \ menu \
@ -79,52 +58,36 @@ RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}
&& rm websockify.zip \ && rm websockify.zip \
&& ln noVNC/vnc_auto.html noVNC/index.html && ln noVNC/vnc_auto.html noVNC/index.html
#=====================
# Install Android SDK
#=====================
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/jre
ENV PATH ${PATH}:${JAVA_HOME}/bin
ENV SDK_VERSION=25.2.3 \
ANDROID_HOME=/root
RUN wget -nv -O android.zip https://dl.google.com/android/repository/tools_r${SDK_VERSION}-linux.zip \
&& unzip android.zip && rm android.zip
ENV PATH ${PATH}:${ANDROID_HOME}/tools
RUN echo y | android update sdk --no-ui -a --filter platform-tools
ENV PATH ${PATH}:${ANDROID_HOME}/platform-tools
#====================================
# Install latest nodejs, npm, appium
#====================================
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - \
&& apt-get -qqy update && apt-get -qqy install nodejs && rm -rf /var/lib/apt/lists/*
ENV APPIUM_VERSION 1.6.3
RUN npm install -g appium@$APPIUM_VERSION && npm cache clean
#====================== #======================
# Install SDK packages # Install SDK packages
#====================== #======================
ARG ANDROID_VERSION=5.0.1 ARG ANDROID_VERSION=5.0.1
ARG BUILD_TOOL=25.0.3
ARG API_LEVEL=21 ARG API_LEVEL=21
ARG PROCESSOR=x86 ARG PROCESSOR=x86
ARG SYS_IMG=x86_64 ARG SYS_IMG=x86_64
ARG IMG_TYPE=google_apis ARG IMG_TYPE=google_apis
ARG BROWSER=android ARG BROWSER=android
ENV ANDROID_VERSION=$ANDROID_VERSION \ ENV ANDROID_VERSION=$ANDROID_VERSION \
BUILD_TOOL=$BUILD_TOOL \
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
RUN echo y | android update sdk --no-ui -a --filter build-tools-${BUILD_TOOL}
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
RUN rm ${ANDROID_HOME}/tools/emulator \ RUN rm ${ANDROID_HOME}/tools/emulator \
&& ln -s ${ANDROID_HOME}/tools/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator && ln -s ${ANDROID_HOME}/tools/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator
RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-${IMG_TYPE}-${API_LEVEL} RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-${IMG_TYPE}-${API_LEVEL}
#==============================================
# Download chrome driver v2.26
# to be able to use chrome browser in emulator
# Issue: https://github.com/butomo1989/docker-android/commit/6406504f944dae73d0a0c5d8e71a17a47dff9b33
#==============================================
RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip" \
&& unzip -x chrome.zip \
&& rm chrome.zip
#================================================ #================================================
# noVNC Default Configurations # noVNC Default Configurations
# These Configurations can be changed through -e # These Configurations can be changed through -e
@ -165,7 +128,7 @@ COPY src /root/src
COPY supervisord.conf /root/ COPY supervisord.conf /root/
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
HEALTHCHECK --interval=2s --timeout=600s --retries=1 \ HEALTHCHECK --interval=2s --timeout=40s --retries=1 \
CMD adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done' CMD adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
CMD /usr/bin/supervisord --configuration supervisord.conf CMD /usr/bin/supervisord --configuration supervisord.conf

View file

@ -1,6 +1,6 @@
FROM ubuntu:16.04 FROM appium/appium:1.6.6-beta-p0
ENV DEBIAN_FRONTEND noninteractive LABEL maintainer "Budi Utomo <budi.ut.1989@gmail.com>"
#============= #=============
# Set WORKDIR # Set WORKDIR
@ -10,29 +10,15 @@ WORKDIR /root
#================== #==================
# General Packages # General Packages
#------------------ #------------------
# wget
# Network downloader
# unzip
# Unzip zip file
# curl
# Transfer data from or to a server
# xterm # xterm
# Terminal emulator # Terminal emulator
# supervisor # supervisor
# Process manager # Process manager
# openjdk-8-jdk
# Java
# libqt5webkit5
# Web content engine (Fix issue in Android)
# socat # socat
# Port forwarder # Port forwarder
# libgconf-2-4
# Required package for chrome and chromedriver to run on Linux
#------------------ #------------------
# NoVNC Packages # NoVNC Packages
#------------------ #------------------
# xvfb
# X virtual framebuffer
# x11vnc # x11vnc
# VNC server for X display # VNC server for X display
# openbox # openbox
@ -54,16 +40,9 @@ WORKDIR /root
# bridge-utils # bridge-utils
#================== #==================
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
wget \
unzip \
curl \
xterm \ xterm \
supervisor \ supervisor \
openjdk-8-jdk \
libqt5webkit5 \
socat \ socat \
libgconf-2-4 \
xvfb \
x11vnc \ x11vnc \
openbox \ openbox \
menu \ menu \
@ -92,52 +71,36 @@ RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}
&& rm websockify.zip \ && rm websockify.zip \
&& ln noVNC/vnc_auto.html noVNC/index.html && ln noVNC/vnc_auto.html noVNC/index.html
#=====================
# Install Android SDK
#=====================
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/jre
ENV PATH ${PATH}:${JAVA_HOME}/bin
ENV SDK_VERSION=25.2.3 \
ANDROID_HOME=/root
RUN wget -nv -O android.zip https://dl.google.com/android/repository/tools_r${SDK_VERSION}-linux.zip \
&& unzip android.zip && rm android.zip
ENV PATH ${PATH}:${ANDROID_HOME}/tools
RUN echo y | android update sdk --no-ui -a --filter platform-tools
ENV PATH ${PATH}:${ANDROID_HOME}/platform-tools
#====================================
# Install latest nodejs, npm, appium
#====================================
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - \
&& apt-get -qqy update && apt-get -qqy install nodejs && rm -rf /var/lib/apt/lists/*
ENV APPIUM_VERSION 1.6.3
RUN npm install -g appium@$APPIUM_VERSION && npm cache clean
#====================== #======================
# Install SDK packages # Install SDK packages
#====================== #======================
ARG ANDROID_VERSION=5.0.1 ARG ANDROID_VERSION=5.0.1
ARG BUILD_TOOL=25.0.3
ARG API_LEVEL=21 ARG API_LEVEL=21
ARG PROCESSOR=x86 ARG PROCESSOR=x86
ARG SYS_IMG=x86_64 ARG SYS_IMG=x86_64
ARG IMG_TYPE=google_apis ARG IMG_TYPE=google_apis
ARG BROWSER=android ARG BROWSER=android
ENV ANDROID_VERSION=$ANDROID_VERSION \ ENV ANDROID_VERSION=$ANDROID_VERSION \
BUILD_TOOL=$BUILD_TOOL \
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
RUN echo y | android update sdk --no-ui -a --filter build-tools-${BUILD_TOOL}
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
RUN rm ${ANDROID_HOME}/tools/emulator \ RUN rm ${ANDROID_HOME}/tools/emulator \
&& ln -s ${ANDROID_HOME}/tools/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator && ln -s ${ANDROID_HOME}/tools/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator
RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-${IMG_TYPE}-${API_LEVEL} RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-${IMG_TYPE}-${API_LEVEL}
#==============================================
# Download chrome driver v2.26
# to be able to use chrome browser in emulator
# Issue: https://github.com/butomo1989/docker-android/commit/6406504f944dae73d0a0c5d8e71a17a47dff9b33
#==============================================
RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip" \
&& unzip -x chrome.zip \
&& rm chrome.zip
#================================================ #================================================
# noVNC Default Configurations # noVNC Default Configurations
# These Configurations can be changed through -e # These Configurations can be changed through -e