2017-12-23 04:18:43 +00:00
|
|
|
FROM hramos/android-base:latest
|
2017-02-24 18:48:10 +00:00
|
|
|
|
|
|
|
# set default environment variables
|
2017-12-22 01:19:52 +00:00
|
|
|
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=\"-Xmx512m -XX:+HeapDumpOnOutOfMemoryError\""
|
2017-02-24 18:48:10 +00:00
|
|
|
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
|
|
|
|
|
|
|
|
# add ReactAndroid directory
|
|
|
|
ADD .buckconfig /app/.buckconfig
|
|
|
|
ADD .buckjavaargs /app/.buckjavaargs
|
|
|
|
ADD ReactAndroid /app/ReactAndroid
|
|
|
|
ADD ReactCommon /app/ReactCommon
|
|
|
|
ADD keystores /app/keystores
|
|
|
|
|
|
|
|
# set workdir
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# run buck fetches
|
|
|
|
RUN buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
|
|
|
|
RUN buck fetch ReactAndroid/src/main/java/com/facebook/react
|
|
|
|
RUN buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
|
|
|
|
RUN buck fetch ReactAndroid/src/test/...
|
|
|
|
RUN buck fetch ReactAndroid/src/androidTest/...
|
|
|
|
|
|
|
|
# build app
|
|
|
|
RUN buck build ReactAndroid/src/main/java/com/facebook/react
|
|
|
|
RUN buck build ReactAndroid/src/main/java/com/facebook/react/shell
|
|
|
|
|
|
|
|
ADD gradle /app/gradle
|
|
|
|
ADD gradlew /app/gradlew
|
|
|
|
ADD settings.gradle /app/settings.gradle
|
|
|
|
ADD build.gradle /app/build.gradle
|
|
|
|
ADD react.gradle /app/react.gradle
|
|
|
|
|
|
|
|
# run gradle downloads
|
2017-03-30 00:54:11 +00:00
|
|
|
RUN ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders
|
2017-02-24 18:48:10 +00:00
|
|
|
|
|
|
|
# compile native libs with Gradle script, we need bridge for unit and integration tests
|
|
|
|
RUN ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1 -Pcom.android.build.threadPoolSize=1
|
|
|
|
|
|
|
|
# add all react-native code
|
|
|
|
ADD . /app
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# https://github.com/npm/npm/issues/13306
|
|
|
|
RUN cd $(npm root -g)/npm && npm install fs-extra && sed -i -e s/graceful-fs/fs-extra/ -e s/fs.rename/fs.move/ ./lib/utils/rename.js
|
|
|
|
|
|
|
|
# build node dependencies
|
|
|
|
RUN npm install
|
|
|
|
|
|
|
|
WORKDIR /app
|