@@ -20,10 +20,14 @@ FROM ubuntu:18.04
2020ENV ANDROID_HOME="/opt/android"
2121
2222RUN apt -y update -qq \
23- && apt -y install -qq --no-install-recommends curl unzip \
24- && apt -y autoremove \
25- && apt -y clean
23+ && apt -y install -qq --no-install-recommends curl unzip ca-certificates \
24+ && apt -y autoremove
2625
26+ # retry helper script, refs:
27+ # https://github.com/kivy/python-for-android/issues/1306
28+ ENV RETRY="retry -t 3 --"
29+ RUN curl https://raw.githubusercontent.com/kadwanev/retry/1.0.1/retry \
30+ --output /usr/local/bin/retry && chmod +x /usr/local/bin/retry
2731
2832ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
2933ENV ANDROID_NDK_VERSION="17c"
@@ -34,7 +38,7 @@ ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip"
3438ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"
3539
3640# download and install Android NDK
37- RUN curl --location --progress-bar --insecure \
41+ RUN ${RETRY} curl --location --progress-bar --insecure \
3842 "${ANDROID_NDK_DL_URL}" \
3943 --output "${ANDROID_NDK_ARCHIVE}" \
4044 && mkdir --parents "${ANDROID_NDK_HOME_V}" \
@@ -52,7 +56,7 @@ ENV ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
5256ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
5357
5458# download and install Android SDK
55- RUN curl --location --progress-bar --insecure \
59+ RUN ${RETRY} curl --location --progress-bar --insecure \
5660 "${ANDROID_SDK_TOOLS_DL_URL}" \
5761 --output "${ANDROID_SDK_TOOLS_ARCHIVE}" \
5862 && mkdir --parents "${ANDROID_SDK_HOME}" \
@@ -65,10 +69,8 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
6569 > "${ANDROID_SDK_HOME}/.android/repositories.cfg"
6670
6771# accept Android licenses (JDK necessary!)
68- RUN apt -y update -qq \
69- && apt -y install -qq --no-install-recommends openjdk-8-jdk \
70- && apt -y autoremove \
71- && apt -y clean
72+ RUN ${RETRY} apt -y install -qq --no-install-recommends openjdk-8-jdk \
73+ && apt -y autoremove
7274RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null
7375
7476# download platforms, API, build tools
@@ -84,27 +86,23 @@ ENV WORK_DIR="${HOME_DIR}" \
8486 PATH="${HOME_DIR}/.local/bin:${PATH}"
8587
8688# install system dependencies
87- RUN apt -y update -qq \
88- && apt -y install -qq --no-install-recommends \
89+ RUN ${RETRY} apt -y install -qq --no-install-recommends \
8990 python virtualenv python-pip wget lbzip2 patch sudo \
90- && apt -y autoremove \
91- && apt -y clean
91+ && apt -y autoremove
9292
9393# build dependencies
9494# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
9595RUN dpkg --add-architecture i386 \
96- && apt -y update -qq \
97- && apt -y install -qq --no-install-recommends \
96+ && ${RETRY} apt -y update -qq \
97+ && ${RETRY} apt -y install -qq --no-install-recommends \
9898 build-essential ccache git python2.7 python2.7-dev \
9999 libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
100100 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
101101 zip zlib1g-dev zlib1g:i386 \
102- && apt -y autoremove \
103- && apt -y clean
102+ && apt -y autoremove
104103
105104# specific recipes dependencies (e.g. libffi requires autoreconf binary)
106- RUN apt -y update -qq \
107- && apt -y install -qq --no-install-recommends \
105+ RUN ${RETRY} apt -y install -qq --no-install-recommends \
108106 libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
109107 && apt -y autoremove \
110108 && apt -y clean
0 commit comments