2018-10-31 08:35:03 +00:00
|
|
|
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
|
|
#
|
|
|
|
# This source code is licensed under the MIT license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
|
2018-05-10 06:26:39 +00:00
|
|
|
# React Native Android Unit Tests
|
|
|
|
#
|
|
|
|
# This image builds upon the React Native Base Android Development Environment
|
|
|
|
# image. Ideally, this image would be rebuilt with any new commit to the master
|
|
|
|
# branch. Doing so will catch issues such as BUCK failing to fetch dependencies
|
|
|
|
# or run tests, as well as unit test failures.
|
2019-01-24 14:22:28 +00:00
|
|
|
FROM react-native-community/react-native
|
2018-05-10 06:26:39 +00:00
|
|
|
|
2018-05-24 19:55:36 +00:00
|
|
|
LABEL Description="This image prepares and runs React Native's Android tests."
|
|
|
|
LABEL maintainer="Héctor Ramos <hector@fb.com>"
|
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
|
2018-03-29 18:29:09 +00:00
|
|
|
ADD ReactNative /app/ReactNative
|
2017-02-24 18:48:10 +00:00
|
|
|
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
|
2018-12-30 18:44:42 +00:00
|
|
|
RUN ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSC
|
2017-02-24 18:48:10 +00:00
|
|
|
|
|
|
|
# compile native libs with Gradle script, we need bridge for unit and integration tests
|
2019-01-14 18:47:14 +00:00
|
|
|
RUN ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1
|
2017-02-24 18:48:10 +00:00
|
|
|
|
|
|
|
# add all react-native code
|
|
|
|
ADD . /app
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# build node dependencies
|
2018-03-29 18:29:09 +00:00
|
|
|
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
|
|
|
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
|
|
|
RUN apt-get install apt-transport-https
|
|
|
|
RUN apt-get update
|
|
|
|
RUN apt-get install yarn
|
|
|
|
RUN yarn
|
2017-02-24 18:48:10 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|