-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
163 lines (136 loc) · 4.61 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
FROM ubuntu:16.04
LABEL maintainer "Trung Le <[email protected]>"
ENV DEBIAN_FRONTEND=noninteractive
#=============
# Set WORKDIR
#=============
WORKDIR /root
#==================
# General Packages
#------------------
# openjdk-8-jdk
# Java
# ca-certificates
# SSL client
# tzdata
# Timezone
# zip
# Make a zip file
# unzip
# Unzip zip file
# curl
# Transfer data from or to a server
# wget
# Network downloader
# libqt5webkit5
# Web content engine (Fix issue in Android)
# libgconf-2-4
# Required package for chrome and chromedriver to run on Linux
# xvfb
# X virtual framebuffer
#==================
RUN apt-get -qqy update && \
apt-get -qqy --no-install-recommends install \
openjdk-8-jdk \
ca-certificates \
tzdata \
zip \
unzip \
curl \
wget \
libqt5webkit5 \
libgconf-2-4 \
xvfb python-pip \
&& rm -rf /var/lib/apt/lists/*
#===============
# Set JAVA_HOME
#===============
ENV JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre" \
PATH=$PATH:$JAVA_HOME/bin
#=====================
# Install Android SDK
#=====================
ARG SDK_VERSION=sdk-tools-linux-3859397
ARG ANDROID_BUILD_TOOLS_VERSION=28.0.0
ARG ANDROID_PLATFORM_VERSION="android-25"
ENV SDK_VERSION=$SDK_VERSION \
ANDROID_BUILD_TOOLS_VERSION=$ANDROID_BUILD_TOOLS_VERSION \
ANDROID_HOME=/root
RUN wget -O tools.zip https://dl.google.com/android/repository/${SDK_VERSION}.zip && \
unzip tools.zip && rm tools.zip && \
chmod a+x -R $ANDROID_HOME && \
chown -R root:root $ANDROID_HOME
ENV PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin
# https://askubuntu.com/questions/885658/android-sdk-repositories-cfg-could-not-be-loaded
RUN mkdir -p ~/.android && \
touch ~/.android/repositories.cfg && \
echo y | sdkmanager "platform-tools" && \
echo y | sdkmanager "build-tools;$ANDROID_BUILD_TOOLS_VERSION" && \
echo y | sdkmanager "platforms;$ANDROID_PLATFORM_VERSION"
ENV PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools
#====================================
# Install latest nodejs, npm, appium
#====================================
ENV APPIUM_VERSION=1.8.1
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - && \
apt-get -qqy install nodejs && \
npm install -g appium@${APPIUM_VERSION} && \
npm cache clean && \
apt-get remove --purge -y npm && \
apt-get autoremove --purge -y && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
apt-get clean
#==================================
# Fix Issue with timezone mismatch
#==================================
ENV TZ="US/Pacific"
RUN echo "${TZ}" > /etc/timezone
RUN apt-get -qqy update && \
apt-get -qqy --no-install-recommends install build-essential git bzip2 libssl-dev libreadline-dev zlib1g-dev&& \
apt-get clean
#==============
# Install ruby
#==============
RUN git clone git://github.com/rbenv/rbenv.git /usr/local/rbenv \
&& git clone git://github.com/rbenv/ruby-build.git /usr/local/rbenv/plugins/ruby-build \
&& git clone git://github.com/jf/rbenv-gemset.git /usr/local/rbenv/plugins/rbenv-gemset \
&& /usr/local/rbenv/plugins/ruby-build/install.sh
ENV PATH /usr/local/rbenv/bin:$PATH
ENV RBENV_ROOT /usr/local/rbenv
RUN echo 'export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh \
&& echo 'export PATH=/usr/local/rbenv/bin:$PATH' >> /etc/profile.d/rbenv.sh \
&& echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
RUN echo 'export RBENV_ROOT=/usr/local/rbenv' >> /root/.bashrc \
&& echo 'export PATH=/usr/local/rbenv/bin:$PATH' >> /root/.bashrc \
&& echo 'eval "$(rbenv init -)"' >> /root/.bashrc
ENV CONFIGURE_OPTS --disable-install-doc
ENV PATH /usr/local/rbenv/bin:/usr/local/rbenv/shims:$PATH
ENV RBENV_VERSION 2.5.1
RUN eval "$(rbenv init -)"; rbenv install $RBENV_VERSION \
&& eval "$(rbenv init -)"; rbenv global $RBENV_VERSION \
&& eval "$(rbenv init -)"; gem update --system \
&& eval "$(rbenv init -)"; gem install bundler -f \
&& rm -rf /tmp/*
#===============
# Expose Ports
#---------------
# 4723
# Appium port
#===============
EXPOSE 4723
#====================================================
# Scripts to run appium and connect to Selenium Grid
#====================================================
COPY entry_point.sh \
generate_config.sh \
wireless_connect.sh \
wireless_autoconnect.sh \
/root/
RUN chmod +x /root/entry_point.sh && \
chmod +x /root/generate_config.sh && \
chmod +x /root/wireless_connect.sh && \
chmod +x /root/wireless_autoconnect.sh
#========================================
# Run xvfb and appium server
#========================================
CMD /root/wireless_autoconnect.sh && /root/entry_point.sh