forked from CedricGatay/docker-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
63 lines (57 loc) · 3.44 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
# Pull base image.
FROM openjdk:jdk-alpine
MAINTAINER Dominik Hahn <[email protected]>
MAINTAINER Cedric Gatay <[email protected]>
# Set ENV
# https://developer.android.com/studio/index.html#command-tools
ENV ANDROID_BUILD_TOOLS_VERSION=build-tools-22.0.1,build-tools-23.0.3,build-tools-24.0.3,build-tools-25.0.3,build-tools-26.0.2,build-tools-27.0.3,build-tools-29.0.0
ENV ANDROID_SDK_FILENAME=sdk-tools-linux-4333796.zip
ENV ANDROID_SDK_URL=https://dl.google.com/android/repository/${ANDROID_SDK_FILENAME}
ENV ANDROID_API_LEVELS=android-17,android-18,android-19,android-20,android-21,android-22,android-23,android-24,android-25,android-26,android-27
ENV ANDROID_HOME=/usr/local/bin/android-sdk-linux
ENV PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
# https://github.com/frol/docker-alpine-glibc/blob/master/Dockerfile
RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \
ALPINE_GLIBC_PACKAGE_VERSION="2.25-r0" && \
ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
apk add --no-cache --virtual=.build-dependencies wget ca-certificates && \
wget \
"https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub" \
-O "/etc/apk/keys/sgerrand.rsa.pub" && \
wget \
"$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
apk add --no-cache \
"$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
\
rm "/etc/apk/keys/sgerrand.rsa.pub" && \
/usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 C.UTF-8 || true && \
echo "export LANG=C.UTF-8" > /etc/profile.d/locale.sh && \
\
apk del glibc-i18n && \
\
rm "/root/.wget-hsts" && \
apk del .build-dependencies && \
rm \
"$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME"
ENV LANG=C.UTF-8
# Install dependencies and Android SDK
RUN apk add --quiet --no-cache libstdc++ bash && \
apk add --quiet --no-cache --virtual build-dependencies curl unzip&& \
curl --create-dirs -sSLo ${ANDROID_HOME}/${ANDROID_SDK_FILENAME} ${ANDROID_SDK_URL} && \
unzip -q ${ANDROID_HOME}/${ANDROID_SDK_FILENAME} -d ${ANDROID_HOME} && \
rm -rf ${ANDROID_HOME}/${ANDROID_SDK_FILENAME} && \
(while sleep 3; do echo "y"; done) | android -s update sdk --no-ui --all --filter tools,platform-tools,${ANDROID_BUILD_TOOLS_VERSION},${ANDROID_API_LEVELS},extra-android-m2repository,extra-google-m2repository && \
apk del build-dependencies && \
rm -rf /var/cache/* /tmp/*
# This accepts the licenses, please keep that in mind, you have to conform to the license.
RUN mkdir -p "$ANDROID_HOME/licenses" &&\
echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license" &&\
echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"