-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
226 lines (195 loc) · 9.66 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
FROM alpine:3.6
# A few problems with compiling Java from source:
# 1. Oracle. Licensing prevents us from redistributing the official JDK.
# 2. Compiling OpenJDK also requires the JDK to be installed, and it gets
# really hairy.
#Set The Environment Variable
# Default to UTF-8 file.encoding
ENV LANG C.UTF-8
ENV VERSION_SDK_TOOLS "25.2.5"
ENV VERSION_BUILD_TOOLS "25.0.3"
ENV VERSION_TARGET_SDK "25
ENV VERSION=v8.1.2 NPM_VERSION=5 YARN_VERSION=latest
ENV SDK_PACKAGES "build-tools-${VERSION_BUILD_TOOLS},android-${VERSION_TARGET_SDK},platform-tools,extra-android-m2repository,extra-google-google_play_services,extra-google-m2repository"
ENV ANDROID_HOME "/opt/android-sdk-linux"
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
ENV GLIBC_VERSION "2.25-r0"
ENV GRADLE_VERSION 2.14
ENV GRADLE_HOME /usr/local/gradle
ENV PATH ${PATH}:${GRADLE_HOME}/bin
ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${ANDROID_HOME}/tools/lib64
ENV RUBY_VERSION 2.4.1-r3
ENV JAVA_VERSION 8u131
ENV JAVA_ALPINE_VERSION 8.131.11-r2
ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
ENV ANDROID_NDK_HOME /opt/android-sdk/ndk-bundle
ENV ANDROID_NDK_VERSION r15b
# add a simple script that can auto-detect the appropriate JAVA_HOME value
# based on whether the JDK or only the JRE is installed
RUN { \
echo '#!/bin/sh'; \
echo 'set -e'; \
echo; \
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
} > /usr/local/bin/docker-java-home \
&& chmod +x /usr/local/bin/docker-java-home
#installing necessary packages
RUN set -x \
&& apk add --no-cache git maven bash iperf curl maven openssh libstdc++ make gcc g++ python linux-headers binutils-gold gnupg \
openjdk8="$JAVA_ALPINE_VERSION" ruby="$RUBY_VERSION" ruby-bundler \
&& [ "$JAVA_HOME" = "$(docker-java-home)" ]
#-------------------------------------installing NODEJS------------------------------------------------------------
# For base builds
# ENV CONFIG_FLAGS="--fully-static --without-npm" DEL_PKGS="libstdc++" RM_DIRS=/usr/include
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
56730D5401028683275BD23C23EFEFE93C4CFFFE && \
curl -sSLO https://nodejs.org/dist/${VERSION}/node-${VERSION}.tar.xz && \
curl -sSL https://nodejs.org/dist/${VERSION}/SHASUMS256.txt.asc | gpg --batch --decrypt | \
grep " node-${VERSION}.tar.xz\$" | sha256sum -c | grep . && \
tar -xf node-${VERSION}.tar.xz && \
cd node-${VERSION} && \
./configure --prefix=/usr ${CONFIG_FLAGS} && \
make -j$(getconf _NPROCESSORS_ONLN) && \
make install && \
cd / && \
if [ -z "$CONFIG_FLAGS" ]; then \
npm install -g npm@${NPM_VERSION} && \
find /usr/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf && \
if [ -n "$YARN_VERSION" ]; then \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
6A010C5166006599AA17F08146C2130DFD2497F5 && \
curl -sSL -O https://yarnpkg.com/${YARN_VERSION}.tar.gz -O https://yarnpkg.com/${YARN_VERSION}.tar.gz.asc && \
gpg --batch --verify ${YARN_VERSION}.tar.gz.asc ${YARN_VERSION}.tar.gz && \
mkdir /usr/local/share/yarn && \
tar -xf ${YARN_VERSION}.tar.gz -C /usr/local/share/yarn --strip 1 && \
ln -s /usr/local/share/yarn/bin/yarn /usr/local/bin/ && \
ln -s /usr/local/share/yarn/bin/yarnpkg /usr/local/bin/ && \
rm ${YARN_VERSION}.tar.gz*; \
fi; \
fi && \
rm -rf /node-${VERSION}* /usr/share/man /tmp/* /var/cache/apk/* \
/root/.npm /root/.node-gyp /root/.gnupg /usr/lib/node_modules/npm/man \
/usr/lib/node_modules/npm/doc /usr/lib/node_modules/npm/html /usr/lib/node_modules/npm/scripts
#------------Installing Glibc Packages----------------------------------------------------------------
RUN apk add --no-cache --virtual=.build-dependencies wget unzip ca-certificates && \
wget https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub -O /etc/apk/keys/sgerrand.rsa.pub && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$GLIBC_VERSION/glibc-$GLIBC_VERSION.apk -O /tmp/glibc.apk && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$GLIBC_VERSION/glibc-bin-$GLIBC_VERSION.apk -O /tmp/glibc-bin.apk && \
apk add --no-cache /tmp/glibc.apk /tmp/glibc-bin.apk && \
rm -rf /tmp/* && \
rm -rf /var/cache/apk/*
# -----------Installing GRADLE ------------------------------
WORKDIR /usr/local
RUN wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip && \
unzip gradle-$GRADLE_VERSION-bin.zip && \
rm -f gradle-$GRADLE_VERSION-bin.zip && \
ln -s gradle-$GRADLE_VERSION gradle && \
echo -ne "- with Gradle $GRADLE_VERSION\n" >> /root/.built
# Download and extract Android Tools
RUN wget http://dl.google.com/android/repository/tools_r${VERSION_SDK_TOOLS}-linux.zip -O /tmp/tools.zip && \
mkdir -p $ANDROID_HOME && \
unzip /tmp/tools.zip -d $ANDROID_HOME && \
rm -v /tmp/tools.zip
# Install SDK Packages
RUN mkdir -p $ANDROID_HOME/licenses/ && \
echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > $ANDROID_HOME/licenses/android-sdk-license && \
echo "84831b9409646a918e30573bab4c9c91346d8abd" > $ANDROID_HOME/licenses/android-sdk-preview-license && \
chmod +x $ANDROID_HOME/tools/android && \
(while [ 1 ]; do sleep 5; echo y; done) | ${ANDROID_HOME}/tools/android update sdk -u -a -t ${SDK_PACKAGES}
RUN touch ~/.android/repositories.cfg
RUN sdkmanager "platform-tools"
# SDKs
# Please keep these in descending order!
RUN sdkmanager "platforms;android-26"
RUN sdkmanager "platforms;android-25"
RUN sdkmanager "platforms;android-24"
RUN sdkmanager "platforms;android-23"
RUN sdkmanager "platforms;android-22"
RUN sdkmanager "platforms;android-21"
RUN sdkmanager "platforms;android-20"
RUN sdkmanager "platforms;android-19"
RUN sdkmanager "platforms;android-18"
RUN sdkmanager "platforms;android-17"
RUN sdkmanager "platforms;android-16"
# build tools
# Please keep these in descending order!
RUN sdkmanager "build-tools;26.0.0"
RUN sdkmanager "build-tools;25.0.2"
RUN sdkmanager "build-tools;25.0.1"
RUN sdkmanager "build-tools;25.0.0"
RUN sdkmanager "build-tools;24.0.3"
RUN sdkmanager "build-tools;24.0.2"
RUN sdkmanager "build-tools;24.0.1"
RUN sdkmanager "build-tools;24.0.0"
RUN sdkmanager "build-tools;23.0.3"
RUN sdkmanager "build-tools;23.0.2"
RUN sdkmanager "build-tools;23.0.1"
RUN sdkmanager "build-tools;23.0.0"
RUN sdkmanager "build-tools;22.0.1"
RUN sdkmanager "build-tools;22.0.0"
RUN sdkmanager "build-tools;21.1.2"
RUN sdkmanager "build-tools;21.1.1"
RUN sdkmanager "build-tools;21.1.0"
RUN sdkmanager "build-tools;21.0.2"
RUN sdkmanager "build-tools;21.0.1"
RUN sdkmanager "build-tools;21.0.0"
RUN sdkmanager "build-tools;20.0.0"
RUN sdkmanager "build-tools;19.1.0"
RUN sdkmanager "build-tools;19.0.3"
RUN sdkmanager "build-tools;19.0.2"
RUN sdkmanager "build-tools;19.0.1"
RUN sdkmanager "build-tools;19.0.0"
# Android System Images, for emulators
# Please keep these in descending order!
#RUN sdkmanager "system-images;android-25;google_apis;armeabi-v7a"
#RUN sdkmanager "system-images;android-24;default;armeabi-v7a"
#RUN sdkmanager "system-images;android-22;default;armeabi-v7a"
#RUN sdkmanager "system-images;android-21;default;armeabi-v7a"
#RUN sdkmanager "system-images;android-19;default;armeabi-v7a"
#RUN sdkmanager "system-images;android-18;default;armeabi-v7a"
#RUN sdkmanager "system-images;android-17;default;armeabi-v7a"
#RUN sdkmanager "system-images;android-16;default;armeabi-v7a"
# Extras
RUN sdkmanager "extras;google;m2repository"
RUN sdkmanager "extras;google;auto"
RUN sdkmanager "extras;google;market_apk_expansion"
RUN sdkmanager "extras;google;market_licensing"
RUN sdkmanager "extras;google;play_billing"
RUN sdkmanager "extras;google;simulators"
RUN sdkmanager "extras;google;webdriver"
RUN sdkmanager "extras;google;google_play_services"
# Constraint Layout
# Please keep these in descending order!
RUN sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
RUN sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1"
# google apis
# Please keep these in descending order!
RUN sdkmanager "add-ons;addon-google_apis-google-24"
RUN sdkmanager "add-ons;addon-google_apis-google-23"
RUN sdkmanager "add-ons;addon-google_apis-google-22"
RUN sdkmanager "add-ons;addon-google_apis-google-21"
RUN sdkmanager "add-ons;addon-google_apis-google-19"
RUN sdkmanager "add-ons;addon-google_apis-google-18"
RUN sdkmanager "add-ons;addon-google_apis-google-17"
RUN sdkmanager "add-ons;addon-google_apis-google-16"
#-----------------installing Android NDK------------------------------
#---------Installing andorid ndk-----------------------------------------
RUN mkdir /opt/android-ndk-tmp && \
cd /opt/android-ndk-tmp && \
wget -q https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \
# uncompress
unzip android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip -d $ANDROID_HOME && \
# move to its final location
mv $ANDROID_HOME/android-ndk-r15b/ $ANDROID_HOME/ndk-bundle && \
# remove temp dir
rm -rf /opt/android-ndk-tmp
# ------------------------------------------------------
VOLUME "/var/lib/build/workspace"
WORKDIR "/var/lib/build/workspace"