Skip to content

Instantly share code, notes, and snippets.

@de-sh
Created November 20, 2022 16:45
Show Gist options
  • Save de-sh/4c83b3dc702fd4bd6ee56b8e51a615f8 to your computer and use it in GitHub Desktop.
Save de-sh/4c83b3dc702fd4bd6ee56b8e51a615f8 to your computer and use it in GitHub Desktop.
Container used to build uplink for Android targets
FROM rust
COPY ./setup.sh .
RUN ./setup.sh
# Install dependencies such as the JDK with apt
apt update && apt install libc6-dev-i386 lib32z1 default-jdk -y
# Download and extract contents of the android developer command-line tools package
wget https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip
mkdir ~/android && mv commandlinetools-linux-9123335_latest.zip ~/android && cd ~/android
unzip commandlinetools-linux-9123335_latest.zip && rm commandlinetools-linux-9123335_latest.zip
# Restructure the tools directory and export the proper PATH value for extracted tool binaries
mkdir tools && mv cmdline-tools/* tools && mv tools cmdline-tools
export ANDROID_HOME="$HOME/android"
export PATH="$ANDROID_HOME/cmdline-tools/tools/bin/:$ANDROID_HOME/emulator/:$ANDROID_HOME/platform-tools/:$PATH"
# Install the NDK with sdkmanager
yes | sdkmanager --install "ndk;25.1.8937393"
# Install the cargo-ndk utility
cargo install cargo-ndk
# Add support for compiling to the android targets
for TARGET in "x86_64-linux-android" "armv7-linux-androideabi" "aarch64-linux-android" "i686-linux-android"; do
rustup target add $TARGET
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment