Improve docker
Summary: Improve current docker by * Make android build version and tools version config easily, and bump them to 26. * use less file layer * fix current docker error (the maintainer line) * fix typo in package.json Since ci on master branch still failed, and I run test the docker build. And in the process I found buck related config still is 23. none [GENERAL] [ENHANCEMENT] [CI] - Improve docker Closes https://github.com/facebook/react-native/pull/19354 Differential Revision: D8148376 Pulled By: hramos fbshipit-source-id: 8f965860487467c1a219e64588ff3000d571ddc1
This commit is contained in:
parent
c09d509c2b
commit
6d2ed2c170
|
@ -6,7 +6,8 @@
|
|||
# or run tests, as well as unit test failures.
|
||||
FROM reactnativeci/android-base:latest
|
||||
|
||||
LABEL Description="This image prepares and runs React Native's Android tests." maintainer "Héctor Ramos <hector@fb.com>"
|
||||
LABEL Description="This image prepares and runs React Native's Android tests."
|
||||
LABEL maintainer="Héctor Ramos <hector@fb.com>"
|
||||
|
||||
# set default environment variables
|
||||
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=\"-Xmx512m -XX:+HeapDumpOnOutOfMemoryError\""
|
||||
|
|
|
@ -13,10 +13,13 @@
|
|||
|
||||
FROM library/ubuntu:16.04
|
||||
|
||||
LABEL Description="This image provides a base Android development environment for React Native, and may be used to run tests." maintainer "Héctor Ramos <hector@fb.com>"
|
||||
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>"
|
||||
|
||||
# set default build arguments
|
||||
ARG ANDROID_TOOLS_VERSION=25.2.5
|
||||
ARG SDK_VERSION=sdk-tools-linux-3859397.zip
|
||||
ARG ANDROID_BUILD_VERSION=26
|
||||
ARG ANDROID_TOOLS_VERSION=26.0.3
|
||||
ARG BUCK_VERSION=v2018.02.16.01
|
||||
ARG NDK_VERSION=10e
|
||||
ARG NODE_VERSION=8.10.0
|
||||
|
@ -35,8 +38,8 @@ ENV PATH=${PATH}:${ANDROID_NDK}
|
|||
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
|
||||
RUN npm config set spin=false
|
||||
RUN npm config set progress=false
|
||||
RUN npm config set spin=false && \
|
||||
npm config set progress=false
|
||||
|
||||
# install node
|
||||
RUN npm install n -g
|
||||
|
@ -51,31 +54,25 @@ RUN ant
|
|||
|
||||
# Full reference at https://dl.google.com/android/repository/repository2-1.xml
|
||||
# download and unpack android
|
||||
RUN mkdir /opt/android
|
||||
WORKDIR /opt/android
|
||||
RUN curl --silent https://dl.google.com/android/repository/tools_r$ANDROID_TOOLS_VERSION-linux.zip > android.zip
|
||||
RUN unzip android.zip
|
||||
RUN rm android.zip
|
||||
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
|
||||
|
||||
# download and unpack NDK
|
||||
RUN mkdir /opt/ndk
|
||||
WORKDIR /opt/ndk
|
||||
RUN curl --silent https://dl.google.com/android/repository/android-ndk-r$NDK_VERSION-linux-x86_64.zip > ndk.zip
|
||||
RUN unzip ndk.zip
|
||||
|
||||
# cleanup NDK
|
||||
RUN rm ndk.zip
|
||||
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
|
||||
|
||||
# Add android SDK tools
|
||||
RUN echo "y" | sdkmanager "system-images;android-19;google_apis;armeabi-v7a"
|
||||
RUN echo "y" | sdkmanager "platforms;android-23"
|
||||
RUN echo "y" | sdkmanager "platforms;android-19"
|
||||
RUN echo "y" | sdkmanager "build-tools;23.0.1"
|
||||
RUN echo "y" | sdkmanager "add-ons;addon-google_apis-google-23"
|
||||
RUN echo "y" | sdkmanager "extras;android;m2repository"
|
||||
|
||||
# Link adb executable
|
||||
RUN ln -s /opt/android/platform-tools/adb /usr/bin/adb
|
||||
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"
|
||||
|
||||
# clean up unnecessary directories
|
||||
RUN rm -rf /opt/android/system-images/android-19/default/x86
|
||||
|
|
|
@ -131,9 +131,9 @@
|
|||
"docker-setup-android": "docker pull reactnativeci/android-base:latest",
|
||||
"docker-build-android-base": "docker build -t reactnativeci/android-base -f ContainerShip/Dockerfile.android-base .",
|
||||
"docker-build-android": "docker build -t reactnativeci/android -f ContainerShip/Dockerfile.android .",
|
||||
"test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it react/android bash ContainerShip/scripts/run-android-docker-instrumentation-tests.sh",
|
||||
"test-android-run-unit": "docker run --cap-add=SYS_ADMIN -it react/android bash ContainerShip/scripts/run-android-docker-unit-tests.sh",
|
||||
"test-android-run-e2e": "docker run --privileged -it react/android bash ContainerShip/scripts/run-ci-e2e-tests.sh --android --js",
|
||||
"test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash ContainerShip/scripts/run-android-docker-instrumentation-tests.sh",
|
||||
"test-android-run-unit": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash ContainerShip/scripts/run-android-docker-unit-tests.sh",
|
||||
"test-android-run-e2e": "docker run --privileged -it reactnativeci/android bash ContainerShip/scripts/run-ci-e2e-tests.sh --android --js",
|
||||
"test-android-all": "yarn run docker-build-android && yarn run test-android-run-unit && yarn run test-android-run-instrumentation && yarn run test-android-run-e2e",
|
||||
"test-android-instrumentation": "yarn run docker-build-android && yarn run test-android-run-instrumentation",
|
||||
"test-android-unit": "yarn run docker-build-android && yarn run test-android-run-unit",
|
||||
|
|
Loading…
Reference in New Issue