2018-05-10 06:26:39 +00:00
|
|
|
# React Native Base Android Development Environment
|
|
|
|
#
|
|
|
|
# This image provides a base Android development environment for React Native,
|
|
|
|
# including, but not limited to, the Android SDK, Android NDK, Node, and BUCK.
|
|
|
|
# These are required in order to run React Native's Android unit and integration
|
|
|
|
# tests.
|
|
|
|
#
|
|
|
|
# This image is not currently built automatically as part of React Native's CI
|
|
|
|
# infrastructure. It should not be necessary to rebuild this image while the
|
|
|
|
# Android dependencies (Android SDK version, build tools version, etc) remain
|
|
|
|
# equal. The operations performed to build this image are those that tend to
|
|
|
|
# remain stable across commits in any given React Native release.
|
|
|
|
|
2017-02-24 18:48:10 +00:00
|
|
|
FROM library/ubuntu:16.04
|
|
|
|
|
2018-05-24 19:55:36 +00:00
|
|
|
LABEL Description="This image provides a base Android development environment for React Native, and may be used to run tests."
|
|
|
|
LABEL maintainer="Héctor Ramos <hector@fb.com>"
|
2018-05-10 06:26:39 +00:00
|
|
|
|
2017-02-24 18:48:10 +00:00
|
|
|
# set default build arguments
|
2018-05-24 19:55:36 +00:00
|
|
|
ARG SDK_VERSION=sdk-tools-linux-3859397.zip
|
|
|
|
ARG ANDROID_BUILD_VERSION=26
|
|
|
|
ARG ANDROID_TOOLS_VERSION=26.0.3
|
2018-07-30 20:54:03 +00:00
|
|
|
ARG BUCK_VERSION=v2018.07.23.01
|
|
|
|
ARG NDK_VERSION=17b
|
2018-03-29 18:29:09 +00:00
|
|
|
ARG NODE_VERSION=8.10.0
|
|
|
|
ARG WATCHMAN_VERSION=4.9.0
|
2017-02-24 18:48:10 +00:00
|
|
|
|
|
|
|
# set default environment variables
|
|
|
|
ENV ADB_INSTALL_TIMEOUT=10
|
|
|
|
ENV PATH=${PATH}:/opt/buck/bin/
|
|
|
|
ENV ANDROID_HOME=/opt/android
|
|
|
|
ENV ANDROID_SDK_HOME=${ANDROID_HOME}
|
2017-12-22 01:19:52 +00:00
|
|
|
ENV PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
|
2017-02-24 18:48:10 +00:00
|
|
|
ENV ANDROID_NDK=/opt/ndk/android-ndk-r$NDK_VERSION
|
|
|
|
ENV PATH=${PATH}:${ANDROID_NDK}
|
|
|
|
|
|
|
|
# install system dependencies
|
|
|
|
RUN apt-get update && apt-get install ant autoconf automake curl g++ gcc git libqt5widgets5 lib32z1 lib32stdc++6 make maven npm openjdk-8* python-dev python3-dev qml-module-qtquick-controls qtdeclarative5-dev unzip -y
|
|
|
|
|
|
|
|
# configure npm
|
2018-05-24 19:55:36 +00:00
|
|
|
RUN npm config set spin=false && \
|
|
|
|
npm config set progress=false
|
2017-02-24 18:48:10 +00:00
|
|
|
|
|
|
|
# install node
|
|
|
|
RUN npm install n -g
|
|
|
|
RUN n $NODE_VERSION
|
|
|
|
|
|
|
|
# download buck
|
2017-12-22 01:19:52 +00:00
|
|
|
RUN git clone https://github.com/facebook/buck.git /opt/buck --branch $BUCK_VERSION --depth=1
|
2017-02-24 18:48:10 +00:00
|
|
|
WORKDIR /opt/buck
|
|
|
|
|
|
|
|
# build buck
|
|
|
|
RUN ant
|
|
|
|
|
2017-12-22 01:19:52 +00:00
|
|
|
# Full reference at https://dl.google.com/android/repository/repository2-1.xml
|
2017-02-24 18:48:10 +00:00
|
|
|
# download and unpack android
|
2018-05-24 19:55:36 +00:00
|
|
|
RUN mkdir /opt/android && \
|
|
|
|
cd /opt/android && \
|
|
|
|
curl --silent https://dl.google.com/android/repository/${SDK_VERSION} > android.zip && \
|
|
|
|
unzip android.zip && \
|
|
|
|
rm android.zip
|
2017-02-24 18:48:10 +00:00
|
|
|
|
|
|
|
# download and unpack NDK
|
2018-05-24 19:55:36 +00:00
|
|
|
RUN mkdir /opt/ndk && \
|
|
|
|
cd /opt/ndk && \
|
|
|
|
curl --silent https://dl.google.com/android/repository/android-ndk-r$NDK_VERSION-linux-x86_64.zip > ndk.zip && \
|
|
|
|
unzip ndk.zip && \
|
|
|
|
rm ndk.zip
|
2017-02-24 18:48:10 +00:00
|
|
|
|
2017-03-30 00:54:11 +00:00
|
|
|
# Add android SDK tools
|
2018-05-24 19:55:36 +00:00
|
|
|
RUN sdkmanager "system-images;android-19;google_apis;armeabi-v7a" \
|
|
|
|
"platforms;android-$ANDROID_BUILD_VERSION" \
|
|
|
|
"build-tools;$ANDROID_TOOLS_VERSION" \
|
|
|
|
"add-ons;addon-google_apis-google-23" \
|
|
|
|
"extras;android;m2repository"
|
2017-02-24 18:48:10 +00:00
|
|
|
|
|
|
|
# clean up unnecessary directories
|
|
|
|
RUN rm -rf /opt/android/system-images/android-19/default/x86
|