forked from mingchen/docker-android-build-box
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
192 lines (176 loc) · 7.24 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
FROM node:12
MAINTAINER Manish Kumar
ENV ANDROID_HOME="/opt/android-sdk" \
ANDROID_NDK="/opt/android-ndk" \
FLUTTER_HOME="/opt/flutter" \
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
# Get the latest version from https://developer.android.com/studio/index.html
ENV ANDROID_SDK_TOOLS_VERSION="4333796"
# Get the latest version from https://developer.android.com/ndk/downloads/index.html
ENV ANDROID_NDK_VERSION="20"
# Set locale
ENV LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"
RUN wget -qO - https://raw.githubusercontent.com/yarnpkg/releases/gh-pages/debian/pubkey.gpg | apt-key add -
RUN apt-get clean && apt-get update && apt-get install -y apt-utils locales && locale-gen $LANG
ENV DEBIAN_FRONTEND="noninteractive" \
TERM=dumb \
DEBIAN_FRONTEND=noninteractive
# Variables must be references after they are created
ENV ANDROID_SDK_HOME="$ANDROID_HOME"
ENV ANDROID_NDK_HOME="$ANDROID_NDK/android-ndk-r$ANDROID_NDK_VERSION"
ENV PATH="$PATH:$ANDROID_SDK_HOME/emulator:$ANDROID_SDK_HOME/tools/bin:$ANDROID_SDK_HOME/tools:$ANDROID_SDK_HOME/platform-tools:$ANDROID_NDK:$FLUTTER_HOME/bin:$FLUTTER_HOME/bin/cache/dart-sdk/bin"
COPY README.md /README.md
WORKDIR /tmp
# Installing packages
RUN apt-get update && \
apt-get install locales && \
locale-gen "$LANG" && \
apt-get install \
build-essential \
autoconf \
libtool \
nasm \
automake \
curl \
git \
file \
less \
vim-tiny \
gpg-agent \
lib32stdc++6 \
lib32z1 \
lib32z1-dev \
lib32ncurses5 \
libc6-dev \
libgmp-dev \
libmpc-dev \
libmpfr-dev \
libxslt-dev \
libxml2-dev \
libpng-dev \
m4 \
ncurses-dev \
ocaml \
openjdk-8-jdk \
openssh-client \
pkg-config \
software-properties-common \
ruby-full \
software-properties-common \
unzip \
wget \
zip \
zlib1g-dev && \
echo "Installing nodejs, npm, cordova, ionic, react-native" && \
apt-get clean && \
rm -rf /var/lib/apt/lists/ && \
npm install -g \
bower cordova eslint gulp \
ionic jshint karma-cli mocha \
node-gyp npm-check-updates \
react-native-cli && \
npm cache clean --force && \
rm -rf /tmp/* /var/tmp/* && \
echo "Installing fastlane" && \
gem install fastlane --no-document && \
gem install bundler --no-document
# # Install Android SDK
# RUN echo "Installing sdk tools ${ANDROID_SDK_TOOLS_VERSION}" && \
# wget --quiet --output-document=sdk-tools.zip \
# "https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip" && \
# mkdir --parents "$ANDROID_HOME" && \
# unzip -q sdk-tools.zip -d "$ANDROID_HOME" && \
# rm --force sdk-tools.zip && \
# echo "Installing ndk r${ANDROID_NDK_VERSION}" && \
# wget --quiet --output-document=android-ndk.zip \
# "http://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip" && \
# mkdir --parents "$ANDROID_NDK_HOME" && \
# unzip -q android-ndk.zip -d "$ANDROID_NDK" && \
# rm --force android-ndk.zip && \
# # Install SDKs
# # Please keep these in descending order!
# # The `yes` is for accepting all non-standard tool licenses.
# mkdir --parents "$ANDROID_HOME/.android/" && \
# echo '### User Sources for Android SDK Manager' > \
# "$ANDROID_HOME/.android/repositories.cfg" && \
# yes | "$ANDROID_HOME"/tools/bin/sdkmanager --licenses > /dev/null && \
# echo "Installing platforms" && \
# yes | "$ANDROID_HOME"/tools/bin/sdkmanager \
# "platforms;android-29" \
# "platforms;android-28" \
# "platforms;android-27" \
# "platforms;android-26" \
# "platforms;android-25" \
# "platforms;android-24" \
# "platforms;android-23" \
# "platforms;android-22" \
# "platforms;android-21" \
# "platforms;android-20" \
# "platforms;android-19" \
# "platforms;android-18" \
# "platforms;android-17" \
# "platforms;android-16" > /dev/null && \
# echo "Installing platform tools " && \
# yes | "$ANDROID_HOME"/tools/bin/sdkmanager \
# "platform-tools" > /dev/null && \
# echo "Installing build tools " && \
# yes | "$ANDROID_HOME"/tools/bin/sdkmanager \
# "build-tools;29.0.2" \
# "build-tools;28.0.3" "build-tools;28.0.2" \
# "build-tools;27.0.3" "build-tools;27.0.2" "build-tools;27.0.1" \
# "build-tools;26.0.2" "build-tools;26.0.1" "build-tools;26.0.0" \
# "build-tools;25.0.3" "build-tools;25.0.2" \
# "build-tools;25.0.1" "build-tools;25.0.0" \
# "build-tools;24.0.3" "build-tools;24.0.2" \
# "build-tools;24.0.1" "build-tools;24.0.0" > /dev/null && \
# echo "Installing build tools " && \
# yes | "$ANDROID_HOME"/tools/bin/sdkmanager \
# "build-tools;23.0.3" "build-tools;23.0.2" "build-tools;23.0.1" \
# "build-tools;22.0.1" \
# "build-tools;21.1.2" \
# "build-tools;20.0.0" \
# "build-tools;19.1.0" \
# "build-tools;18.1.1" \
# "build-tools;17.0.0" > /dev/null && \
# echo "Installing extras " && \
# yes | "$ANDROID_HOME"/tools/bin/sdkmanager \
# "extras;android;m2repository" \
# "extras;google;m2repository" > /dev/null && \
# echo "Installing play services " && \
# yes | "$ANDROID_HOME"/tools/bin/sdkmanager \
# "extras;google;google_play_services" \
# "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" \
# "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" > /dev/null && \
# echo "Installing Google APIs" && \
# yes | "$ANDROID_HOME"/tools/bin/sdkmanager \
# "add-ons;addon-google_apis-google-24" \
# "add-ons;addon-google_apis-google-23" \
# "add-ons;addon-google_apis-google-22" \
# "add-ons;addon-google_apis-google-21" \
# "add-ons;addon-google_apis-google-19" \
# "add-ons;addon-google_apis-google-18" \
# "add-ons;addon-google_apis-google-17" \
# "add-ons;addon-google_apis-google-16" > /dev/null && \
# echo "Installing emulator " && \
# yes | "$ANDROID_HOME"/tools/bin/sdkmanager "emulator" > /dev/null && \
# echo "Installing kotlin" && \
# wget --quiet -O sdk.install.sh "https://get.sdkman.io" && \
# bash -c "bash ./sdk.install.sh > /dev/null && source ~/.sdkman/bin/sdkman-init.sh && sdk install kotlin" && \
# rm -f sdk.install.sh && \
# # Install Flutter sdk
# cd /opt && \
# wget --quiet https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.5.4-hotfix.2-stable.tar.xz -O flutter.tar.xz && \
# tar xf flutter.tar.xz && \
# rm -f flutter.tar.xz && \
# flutter config --no-analytics
# # Copy sdk license agreement files.
# RUN mkdir -p $ANDROID_HOME/licenses
# COPY sdk/licenses/* $ANDROID_HOME/licenses/
# # Create some jenkins required directory to allow this image run with Jenkins
# RUN mkdir -p /var/lib/jenkins/workspace
# RUN mkdir -p /home/jenkins
# RUN chmod 777 /home/jenkins
# RUN chmod 777 /var/lib/jenkins/workspace
# RUN chmod 777 $ANDROID_HOME/.android