Splitted into different Dockerfiles to optimize size for each docker image
This commit is contained in:
parent
d1a1bb5fa7
commit
e9ed10d08c
169
docker/Emulator_arm
Normal file
169
docker/Emulator_arm
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
FROM ubuntu:16.04
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
|
#=============
|
||||||
|
# Set WORKDIR
|
||||||
|
#=============
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
#==================
|
||||||
|
# General Packages
|
||||||
|
#------------------
|
||||||
|
# wget
|
||||||
|
# Network downloader
|
||||||
|
# unzip
|
||||||
|
# Unzip zip file
|
||||||
|
# curl
|
||||||
|
# Transfer data from or to a server
|
||||||
|
# xterm
|
||||||
|
# Terminal emulator
|
||||||
|
# supervisor
|
||||||
|
# Process manager
|
||||||
|
# openjdk-8-jdk
|
||||||
|
# Java
|
||||||
|
# libqt5webkit5
|
||||||
|
# Web content engine (Fix issue in Android)
|
||||||
|
# socat
|
||||||
|
# Port forwarder
|
||||||
|
# libgconf-2-4
|
||||||
|
# Required package for chrome and chromedriver to run on Linux
|
||||||
|
#------------------
|
||||||
|
# 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
|
||||||
|
#==================
|
||||||
|
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||||
|
wget \
|
||||||
|
unzip \
|
||||||
|
curl \
|
||||||
|
xterm \
|
||||||
|
supervisor \
|
||||||
|
openjdk-8-jdk \
|
||||||
|
libqt5webkit5 \
|
||||||
|
socat \
|
||||||
|
libgconf-2-4 \
|
||||||
|
xvfb \
|
||||||
|
x11vnc \
|
||||||
|
openbox \
|
||||||
|
menu \
|
||||||
|
python-numpy \
|
||||||
|
net-tools \
|
||||||
|
&& 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 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
|
||||||
|
#======================
|
||||||
|
ARG ANDROID_VERSION=5.0.1
|
||||||
|
ARG BUILD_TOOL=25.0.3
|
||||||
|
ARG API_LEVEL=21
|
||||||
|
ARG PROCESSOR=x86
|
||||||
|
ARG SYS_IMG=x86_64
|
||||||
|
ARG IMG_TYPE=google_apis
|
||||||
|
ENV ANDROID_VERSION=$ANDROID_VERSION \
|
||||||
|
BUILD_TOOL=$BUILD_TOOL \
|
||||||
|
API_LEVEL=$API_LEVEL \
|
||||||
|
PROCESSOR=$PROCESSOR \
|
||||||
|
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
|
||||||
|
RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-${IMG_TYPE}-${API_LEVEL}
|
||||||
|
|
||||||
|
#================================================
|
||||||
|
# noVNC Default Configurations
|
||||||
|
# These Configurations can be changed through -e
|
||||||
|
#================================================
|
||||||
|
ENV DISPLAY=:0 \
|
||||||
|
SCREEN=0 \
|
||||||
|
SCREEN_WIDTH=1600 \
|
||||||
|
SCREEN_HEIGHT=900 \
|
||||||
|
SCREEN_DEPTH=16 \
|
||||||
|
LOCAL_PORT=5900 \
|
||||||
|
TARGET_PORT=6080 \
|
||||||
|
TIMEOUT=1 \
|
||||||
|
LOG_PATH=/var/log/supervisor
|
||||||
|
|
||||||
|
#===============
|
||||||
|
# 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
|
||||||
|
|
||||||
|
#===================
|
||||||
|
# Run docker-appium
|
||||||
|
#===================
|
||||||
|
COPY src /root/src
|
||||||
|
COPY supervisord.conf /root/
|
||||||
|
RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=2s --timeout=600s --retries=1 \
|
||||||
|
CMD adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
|
||||||
|
|
||||||
|
CMD /usr/bin/supervisord --configuration supervisord.conf
|
|
@ -176,7 +176,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
|
1
docker/Real_device
Normal file
1
docker/Real_device
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# TODO
|
11
release.sh
11
release.sh
|
@ -103,6 +103,12 @@ function build() {
|
||||||
|
|
||||||
# Build docker image(s)
|
# Build docker image(s)
|
||||||
for p in "${processors[@]}"; do
|
for p in "${processors[@]}"; do
|
||||||
|
if [ "$p" == "x86" ]; then
|
||||||
|
FILE_NAME=docker/Emulator_x86
|
||||||
|
else
|
||||||
|
FILE_NAME=docker/Emulator_arm
|
||||||
|
fi
|
||||||
|
|
||||||
for v in "${versions[@]}"; do
|
for v in "${versions[@]}"; do
|
||||||
# Find image type
|
# Find image type
|
||||||
if [ "$v" == "5.0.1" ] || [ "$v" == "5.1.1" ]; then
|
if [ "$v" == "5.0.1" ] || [ "$v" == "5.1.1" ]; then
|
||||||
|
@ -118,12 +124,13 @@ function build() {
|
||||||
image_version="$IMAGE-$p-$v:$RELEASE"
|
image_version="$IMAGE-$p-$v:$RELEASE"
|
||||||
image_latest="$IMAGE-$p-$v:latest"
|
image_latest="$IMAGE-$p-$v:latest"
|
||||||
echo "[BUILD] Image name: $image_version and $image_latest"
|
echo "[BUILD] Image name: $image_version and $image_latest"
|
||||||
|
echo "[BUILD] Dockerfile: $FILE_NAME"
|
||||||
docker build -t $image_version --build-arg ANDROID_VERSION=$v --build-arg BUILD_TOOL=$LATEST_BUILD_TOOL \
|
docker build -t $image_version --build-arg ANDROID_VERSION=$v --build-arg BUILD_TOOL=$LATEST_BUILD_TOOL \
|
||||||
--build-arg API_LEVEL=$level --build-arg PROCESSOR=$p --build-arg SYS_IMG=$sys_img \
|
--build-arg API_LEVEL=$level --build-arg PROCESSOR=$p --build-arg SYS_IMG=$sys_img \
|
||||||
--build-arg IMG_TYPE=$IMG_TYPE .
|
--build-arg IMG_TYPE=$IMG_TYPE -f $FILE_NAME .
|
||||||
docker build -t $image_latest --build-arg ANDROID_VERSION=$v --build-arg BUILD_TOOL=$LATEST_BUILD_TOOL \
|
docker build -t $image_latest --build-arg ANDROID_VERSION=$v --build-arg BUILD_TOOL=$LATEST_BUILD_TOOL \
|
||||||
--build-arg API_LEVEL=$level --build-arg PROCESSOR=$p --build-arg SYS_IMG=$sys_img \
|
--build-arg API_LEVEL=$level --build-arg PROCESSOR=$p --build-arg SYS_IMG=$sys_img \
|
||||||
--build-arg IMG_TYPE=$IMG_TYPE .
|
--build-arg IMG_TYPE=$IMG_TYPE -f $FILE_NAME .
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue