• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1FROM ubuntu:22.04
2
3RUN dpkg --add-architecture i386
4RUN apt-get update
5RUN apt-get install -y --no-install-recommends libc6-dev gcc
6RUN apt-get install -y --no-install-recommends \
7  file \
8  wget \
9  ca-certificates \
10  python3 \
11  python3-distutils \
12  unzip \
13  expect \
14  openjdk-8-jre \
15  libstdc++6:i386 \
16  libpulse0
17
18WORKDIR /android/
19COPY android* /android/
20
21ENV ANDROID_ARCH=i686
22ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools
23
24RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
25RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
26RUN mv /root/.android /tmp
27RUN chmod 777 -R /tmp/.android
28RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*
29
30ENV PATH=$PATH:/rust/bin \
31    CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
32    CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \
33    CC_i686_linux_android=i686-linux-android-gcc \
34    HOME=/tmp
35
36ADD runtest-android.rs /tmp/runtest.rs
37ENTRYPOINT [ \
38  "bash", \
39  "-c", \
40  # set SHELL so android can detect a 64bits system, see
41  # http://stackoverflow.com/a/41789144
42  "SHELL=/bin/dash /android/sdk/emulator/emulator @i686 -no-window -no-accel & \
43   rustc /tmp/runtest.rs -o /tmp/runtest && \
44   exec \"$@\"", \
45  "--" \
46]
47