|
| 1 | +FROM ubuntu:19.10 |
| 2 | + |
| 3 | +# Arguments that can be overridden in 'docker build' command: |
| 4 | +# Versions of Android SDK, NDK and CMake |
| 5 | +ARG VERSION_SDK=6200805 |
| 6 | +ARG VERSION_NDK=21.0.6113669 |
| 7 | +ARG VERSION_CMAKE=3.10.2.4988404 |
| 8 | + |
| 9 | +# The HOME variable isn't available for ENV directive (during building an image). |
| 10 | +# So we define one manually. For alpine and ubuntu it should be '/root' |
| 11 | +ARG HOME_TWIN=/root |
| 12 | + |
| 13 | +# Creating mandatory environment variables |
| 14 | +ENV ANDROID_SDK_HOME=${HOME_TWIN}/android-sdk |
| 15 | +ENV ANDROID_NDK_HOME=${ANDROID_SDK_HOME}/ndk/${VERSION_NDK} |
| 16 | + |
| 17 | +# Installing basic software |
| 18 | +RUN apt-get update && apt-get install -y \ |
| 19 | + python3 python3-pip python3-setuptools python3-wheel ninja-build \ |
| 20 | + openjdk-8-jdk-headless \ |
| 21 | + curl \ |
| 22 | + unzip \ |
| 23 | + bash \ |
| 24 | + nasm \ |
| 25 | + pkg-config \ |
| 26 | + make |
| 27 | + |
| 28 | +# Meson has to be installed in a different way |
| 29 | +RUN pip3 install meson==0.53.2 |
| 30 | + |
| 31 | +# Download the Android SDK |
| 32 | +RUN curl https://dl.google.com/android/repository/commandlinetools-linux-${VERSION_SDK}_latest.zip --output ${HOME_TWIN}/android-sdk.zip |
| 33 | +# Unzip it and remove the archive |
| 34 | +RUN mkdir -p ${HOME_TWIN}/android-sdk && \ |
| 35 | + unzip -qq ${HOME_TWIN}/android-sdk.zip -d ${HOME_TWIN}/android-sdk && \ |
| 36 | + rm ${HOME_TWIN}/android-sdk.zip |
| 37 | + |
| 38 | +# Installing components through the Android SDK |
| 39 | +RUN installAndroidComponent() { yes | ${ANDROID_SDK_HOME}/tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_HOME} $1 > /dev/null; } && \ |
| 40 | + installAndroidComponent "ndk;${VERSION_NDK}" && \ |
| 41 | + installAndroidComponent "cmake;${VERSION_CMAKE}" |
| 42 | + |
| 43 | +# The command to be executed when a container is running |
| 44 | +# Passing additional arguments to the script is done via FAM_ARGS environment variable |
| 45 | +CMD cd /mnt/ffmpeg-android-maker && ./ffmpeg-android-maker.sh ${FAM_ARGS} |
0 commit comments