docker-android/Dockerfile

176 lines
4.5 KiB
Docker
Raw Normal View History

2017-01-16 11:58:54 +00:00
FROM ubuntu:16.04
2016-12-22 13:29:57 +00:00
2017-01-08 16:24:14 +00:00
ENV DEBIAN_FRONTEND noninteractive
2017-02-11 21:46:41 +00:00
#=============
# Set WORKDIR
#=============
WORKDIR /root
2017-03-21 17:08:24 +00:00
#==================
# General Packages
#------------------
# wget
# Network downloader
# unzip
# Unzip zip file
# curl
# Transfer data from or to a server
2017-03-22 13:28:54 +00:00
# xterm
# Terminal emulator
2017-03-21 17:08:24 +00:00
# supervisor
# Process manager
# openjdk-8-jdk
# Java
# libqt5webkit5
# Web content engine (Fix issue in Android)
2017-04-12 13:25:12 +01:00
# socat
# Port forwarder
2017-03-21 17:08:24 +00:00
#------------------
# NoVNC Packages
#------------------
# xvfb
# X virtual framebuffer
# x11vnc
# VNC server for X display
# openbox
# Windows manager
# menu
# Debian menu
# python-numpy
# Numpy, For faster performance: https://github.com/novnc/websockify/issues/77
# net-tools
# Netstat
#------------------
# KVM Package
# for emulator x86
# https://help.ubuntu.com/community/KVM/Installation
#------------------
# qemu-kvm
# libvirt-bin
# ubuntu-vm-builder
# bridge-utils
#==================
2017-04-21 14:50:12 +01:00
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
2017-03-21 17:08:24 +00:00
wget \
unzip \
curl \
2017-03-22 13:28:54 +00:00
xterm \
2017-03-21 17:08:24 +00:00
supervisor \
openjdk-8-jdk \
libqt5webkit5 \
2017-04-12 13:25:12 +01:00
socat \
2017-03-21 17:08:24 +00:00
xvfb \
x11vnc \
openbox \
menu \
python-numpy \
net-tools \
qemu-kvm \
libvirt-bin \
ubuntu-vm-builder \
bridge-utils \
&& rm -rf /var/lib/apt/lists/*
2017-04-06 09:29:27 +01:00
#=======
# 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"
2017-04-21 14:50:12 +01:00
RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}.zip" \
2017-04-06 09:29:27 +01:00
&& unzip -x noVNC.zip \
&& rm noVNC.zip \
&& mv noVNC-${NOVNC_SHA} noVNC \
2017-04-21 14:50:12 +01:00
&& wget -nv -O websockify.zip "https://github.com/kanaka/websockify/archive/${WEBSOCKIFY_SHA}.zip" \
2017-04-06 09:29:27 +01:00
&& unzip -x websockify.zip \
&& mv websockify-${WEBSOCKIFY_SHA} ./noVNC/utils/websockify \
&& rm websockify.zip \
&& ln noVNC/vnc_auto.html noVNC/index.html
2017-03-21 17:08:24 +00:00
#=====================
# Install Android SDK
#=====================
2017-03-21 17:08:24 +00:00
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
2017-04-21 14:50:12 +01:00
RUN wget -nv -O android.zip https://dl.google.com/android/repository/tools_r${SDK_VERSION}-linux.zip \
2017-03-21 17:08:24 +00:00
&& 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
2016-12-22 13:29:57 +00:00
2017-01-08 16:24:14 +00:00
#====================================
# Install latest nodejs, npm, appium
#====================================
2017-03-21 17:08:24 +00:00
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - \
2017-04-21 14:50:12 +01:00
&& apt-get -qqy update && apt-get -qqy install nodejs && rm -rf /var/lib/apt/lists/*
2016-12-22 13:29:57 +00:00
ENV APPIUM_VERSION 1.6.3
2017-03-21 17:08:24 +00:00
RUN npm install -g appium@$APPIUM_VERSION && npm cache clean
2017-01-23 16:25:21 +00:00
#======================
# Install SDK packages
#======================
ARG ANDROID_VERSION=5.0.1
ARG BUILD_TOOL=21.1.2
ARG API_LEVEL=21
ARG PROCESSOR=x86
ARG SYS_IMG=x86_64
2017-04-26 14:16:26 +01:00
ARG IMG_TYPE=google_apis
ENV ANDROID_VERSION=$ANDROID_VERSION \
BUILD_TOOL=$BUILD_TOOL \
API_LEVEL=$API_LEVEL \
PROCESSOR=$PROCESSOR \
2017-04-26 14:16:26 +01:00
SYS_IMG=$SYS_IMG \
IMG_TYPE=$IMG_TYPE
RUN echo y | android update sdk --no-ui -a --filter build-tools-${BUILD_TOOL}
ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
RUN rm ${ANDROID_HOME}/tools/emulator \
&& ln -s ${ANDROID_HOME}/tools/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator
2017-04-26 14:16:26 +01:00
RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-${IMG_TYPE}-${API_LEVEL}
2017-02-11 21:46:41 +00:00
#================================================
# noVNC Default Configurations
# These Configurations can be changed through -e
#================================================
2017-01-08 16:24:14 +00:00
ENV DISPLAY=:0 \
SCREEN=0 \
SCREEN_WIDTH=1600 \
SCREEN_HEIGHT=900 \
SCREEN_DEPTH=16 \
LOCAL_PORT=5900 \
TARGET_PORT=6080 \
2017-02-11 21:46:41 +00:00
TIMEOUT=1 \
LOG_PATH=/var/log/supervisor
2017-01-08 16:24:14 +00:00
2017-03-21 17:08:24 +00:00
#===============
2017-01-23 16:25:21 +00:00
# Expose Ports
2017-03-21 17:08:24 +00:00
#---------------
# 4723
2017-04-12 13:25:12 +01:00
# Appium port
2017-03-21 17:08:24 +00:00
# 6080
# noVNC port
2017-04-12 13:25:12 +01:00
# 5554
# Emulator port
# 5555
# ADB connection port
2017-03-21 17:08:24 +00:00
#===============
2017-04-12 13:25:12 +01:00
EXPOSE 4723 6080 5554 5555
2017-01-23 16:25:21 +00:00
2017-03-16 15:33:26 +00:00
#======================
# Add Emulator Devices
#======================
COPY devices /root/devices
2016-12-22 13:29:57 +00:00
#===================
# Run docker-appium
#===================
COPY src /root/src
COPY supervisord.conf /root/
2017-04-12 13:25:12 +01:00
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
2017-02-11 21:46:41 +00:00
CMD /usr/bin/supervisord --configuration supervisord.conf