1- # build buck from source
2- FROM ubuntu:20.04 AS buck
3-
4- ARG BUCK_VERSION=2021.01.12.01
5- ENV ANT_OPTS="-Xmx4096m"
6- RUN apt update && apt install -y --no-install-recommends \
7- ant \
8- git \
9- openjdk-11-jdk-headless \
10- python-setuptools \
11- python3-setuptools
12- # install buck by compiling it from source. We also remove the buck repo once it's built.
13- RUN git clone --depth 1 --branch v${BUCK_VERSION} https://github.com/facebook/buck.git \
14- && cd buck \
15- && ant \
16- && ./bin/buck build buck --config java.target_level=11 --config java.source_level=11 --out /tmp/buck.pex
17-
18- # build react native image and use buck built from source from above stage
191FROM ubuntu:20.04
2+
203LABEL Description="This image provides a base Android development environment for React Native, and may be used to run tests."
214
225ENV DEBIAN_FRONTEND=noninteractive
@@ -26,6 +9,7 @@ ENV DEBIAN_FRONTEND=noninteractive
269ARG SDK_VERSION=commandlinetools-linux-8512546_latest.zip
2710ARG ANDROID_BUILD_VERSION=31
2811ARG ANDROID_TOOLS_VERSION=31.0.0
12+ ARG BUCK_VERSION=2022.05.05.01
2913ARG NDK_VERSION=21.4.7075529
3014ARG NODE_VERSION=14.x
3115ARG WATCHMAN_VERSION=4.9.0
@@ -41,8 +25,6 @@ ENV CMAKE_BIN_PATH=${ANDROID_HOME}/cmake/$CMAKE_VERSION/bin
4125
4226ENV PATH=${ANDROID_NDK}:${CMAKE_BIN_PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/emulator:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:/opt/buck/bin/:${PATH}
4327
44- COPY --from=buck /tmp/buck.pex /usr/local/bin/buck
45-
4628# Install system dependencies
4729RUN apt update -qq && apt install -qq -y --no-install-recommends \
4830 apt-transport-https \
@@ -101,6 +83,11 @@ RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION} | bash - \
10183 && npm i -g yarn \
10284 && rm -rf /var/lib/apt/lists/*
10385
86+ # download and install buck using the java11 pex from Jitpack
87+ RUN curl -L https://jitpack.io/com/github/facebook/buck/v${BUCK_VERSION}/buck-v${BUCK_VERSION}-java11.pex -o /tmp/buck.pex \
88+ && mv /tmp/buck.pex /usr/local/bin/buck \
89+ && chmod +x /usr/local/bin/buck
90+
10491# Full reference at https://dl.google.com/android/repository/repository2-1.xml
10592# download and unpack android
10693# workaround buck clang version detection by symlinking
0 commit comments