Skip to content

Commit

Permalink
Update Docker images to latest Android SDK, Buck
Browse files Browse the repository at this point in the history
Summary:
Test Plan

Rebuilt Docker images locally, confirmed successful image build.

Can later be reproed with

```
npm run test-android-setup
npm run test-android-build
npm run test-android-run-unit-tests
```

Note that unit tests are failing in master, but in this PR we can repro the same failure.
Closes #17313

Differential Revision: D6624899

Pulled By: hramos

fbshipit-source-id: 42b8cd708ec2a02399bb6ef30fd73faba2646f79
  • Loading branch information
hramos authored and facebook-github-bot committed Dec 22, 2017
1 parent 7ff6657 commit c547f78
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 42 deletions.
7 changes: 2 additions & 5 deletions ContainerShip/Dockerfile.android
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM containership/android-base:latest

# set default environment variables
ENV GRADLE_OPTS="-Dorg.gradle.jvmargs=\"-Xmx512m -XX:+HeapDumpOnOutOfMemoryError\""
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=\"-Xmx512m -XX:+HeapDumpOnOutOfMemoryError\""
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"

# add ReactAndroid directory
Expand Down Expand Up @@ -38,6 +38,7 @@ RUN ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion
RUN ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1 -Pcom.android.build.threadPoolSize=1

# add all react-native code
# How does this work?
ADD . /app
WORKDIR /app

Expand All @@ -46,9 +47,5 @@ RUN cd $(npm root -g)/npm && npm install fs-extra && sed -i -e s/graceful-fs/fs-

# build node dependencies
RUN npm install
RUN npm install github@0.2.4

WORKDIR /app/website
RUN npm install

WORKDIR /app
48 changes: 12 additions & 36 deletions ContainerShip/Dockerfile.android-base
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM library/ubuntu:16.04

# set default build arguments
ARG ANDROID_VERSION=25.2.3
ARG BUCK_VERSION=f3452a6a7ab15a60e94c962e686293acbe677473
ARG ANDROID_TOOLS_VERSION=25.2.5
ARG BUCK_VERSION=v2017.11.16.01
ARG NDK_VERSION=10e
ARG NODE_VERSION=6.2.0
ARG WATCHMAN_VERSION=4.7.0
Expand All @@ -12,7 +12,7 @@ ENV ADB_INSTALL_TIMEOUT=10
ENV PATH=${PATH}:/opt/buck/bin/
ENV ANDROID_HOME=/opt/android
ENV ANDROID_SDK_HOME=${ANDROID_HOME}
ENV PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
ENV PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
ENV ANDROID_NDK=/opt/ndk/android-ndk-r$NDK_VERSION
ENV PATH=${PATH}:${ANDROID_NDK}

Expand All @@ -28,9 +28,8 @@ RUN npm install n -g
RUN n $NODE_VERSION

# download buck
RUN git clone https://github.com/facebook/buck.git /opt/buck
RUN git clone https://github.com/facebook/buck.git /opt/buck --branch $BUCK_VERSION --depth=1
WORKDIR /opt/buck
RUN git checkout $BUCK_VERSION

# build buck
RUN ant
Expand All @@ -46,10 +45,11 @@ RUN ./configure
RUN make
RUN make install

# 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_VERSION-linux.zip > android.zip
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

Expand All @@ -63,39 +63,15 @@ RUN unzip ndk.zip
RUN rm ndk.zip

# Add android SDK tools

# Android SDK Platform-tools, revision 25.0.4
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Android SDK Platform-tools, revision 25.0.4" | awk '{ print $1 }' | sed 's/.$//')

# Android SDK Build-tools, revision 23.0.1
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Android SDK Build-tools, revision 23.0.1" | awk '{ print $1 }' | sed 's/.$//')

# SDK Platform Android 6.0, API 23, revision 3
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "SDK Platform Android 6.0, API 23" | awk '{ print $1 }' | sed 's/.$//')

# SDK Platform Android 4.4.2, API 19, revision 4
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "SDK Platform Android 4.4.2, API 19, revision 4" | awk '{ print $1 }' | sed 's/.$//')

# ARM EABI v7a System Image, Android API 19, revision 5
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "ARM EABI v7a System Image, Android API 19, revision 5" | awk '{ print $1 }' | sed 's/.$//')

# Intel x86 Atom System Image, Android API 19, revision 5
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Intel x86 Atom System Image, Android API 19, revision 5" | awk '{ print $1 }' | sed 's/.$//')

# Google APIs, Android API 23, revision 1
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Google APIs, Android API 23, revision 1" | awk '{ print $1 }' | sed 's/.$//')

# Android Support Repository, revision 45
RUN echo "y" | android update sdk -u -a -t $(android list sdk -a | grep "Android Support Repository" | awk '{ print $1 }' | sed 's/.$//')
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

# Install google-chrome
RUN curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable

# clean up unnecessary directories
RUN rm -rf /opt/android/system-images/android-19/default/x86
2 changes: 1 addition & 1 deletion ReactAndroid/DEFS
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs):
'-XX:MaxPermSize=620m',
'-Drobolectric.offline=true',
]
if os.path.isdir("/dev/shm") and not os.environ['CIRCLECI']:
if os.path.isdir("/dev/shm") and 'CIRCLECI' not in os.environ:
extra_vm_args.append('-Djava.io.tmpdir=/dev/shm')
else:
extra_vm_args.append(
Expand Down

0 comments on commit c547f78

Please sign in to comment.