Last active
November 23, 2021 14:02
-
-
Save dcm/aa360d02a229ba0488bfe5bd41583ae7 to your computer and use it in GitHub Desktop.
BETA: Base Dockerfile for developing on Android 12 (API level 31), in VSCode with GrapheneOS, in particular.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [Choice] Ubuntu version: bionic, focal | |
ARG VARIANT="focal" | |
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} | |
# Guide for figuring out what to install: | |
## https://gist.github.com/mtsahakis/f7893e3b5f0785dd99f304b4822d9b61 | |
# Installing `repo` | |
## https://source.android.com/setup/develop#installing-repo | |
# Android version -> API level mapping: | |
## https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels | |
# GrapheneOS releases: | |
## https://grapheneos.org/releases#2021112123 | |
# Pixel 6: | |
## https://github.com/GrapheneOS/platform_manifest/releases/tag/SD1A.210817.037.2021112123 | |
ENV SDK_ROOT="/opt/android" | |
ENV PATH="${SDK_ROOT}:${SDK_ROOT}/platform-tools:${SDK_ROOT}/cmdline-tools/bin:${PATH}" | |
#hadolint ignore=DL3008 | |
RUN export DEBIAN_FRONTEND=noninteractive \ | |
&& dpkg --add-architecture i386 \ | |
&& apt-get update \ | |
&& apt-get -y install --no-install-recommends \ | |
apt-file \ | |
build-essential \ | |
gnupg \ | |
git \ | |
wget \ | |
unzip \ | |
openjdk-8-jdk-headless \ | |
jq \ | |
libfreetype6 \ | |
diffutils \ | |
rsync \ | |
zip \ | |
openssl \ | |
e2fsprogs \ | |
libncurses5-dev \ | |
python3 \ | |
python-is-python3 \ | |
file \ | |
signify \ | |
&& KEY_ID="8BB9AD793E8E6153AF0F9A4416530D5E920F5C65" \ | |
&& if [ -f "./${KEY_ID}.pem" ]; then \ | |
gpg --quiet --batch --import ".devcontainer/${KEY_ID}.pem"; \ | |
else \ | |
echo >&2 "It is safer to download the public key for Key ID '${KEY_ID}' prior to building the image."; \ | |
gpg --quiet --batch --keyserver "keys.openpgp.org" --recv-key "${KEY_ID}"; \ | |
fi \ | |
&& mkdir -p "${SDK_ROOT}" \ | |
&& curl -so "${REPO=${SDK_ROOT}/repo}" "https://storage.googleapis.com/git-repo-downloads/repo" \ | |
&& curl -s "https://storage.googleapis.com/git-repo-downloads/repo.asc" | gpg --quiet --batch --verify - "${REPO}" \ | |
&& chmod +x "${REPO}" \ | |
&& wget -qO "${ZIP=commandlinetools-linux-7583922_latest.zip}" "https://dl.google.com/android/repository/${ZIP}" \ | |
&& printf "%s\t%s\n" "124f2d5115eee365df6cf3228ffbca6fc3911d16f8025bebd5b1c6e2fcfa7faf" "$ZIP" | sha256sum --strict --quiet --check \ | |
&& unzip -qd "${SDK_ROOT}" "${ZIP}" \ | |
&& rm -f "${ZIP}" \ | |
&& echo y | sdkmanager --sdk_root="${SDK_ROOT}" --channel=0 --install \ | |
"platform-tools" \ | |
"platforms;android-31" \ | |
"build-tools;31.0.0" \ | |
"emulator" \ | |
"ndk;23.1.7779620" \ | |
"cmake;3.18.1" \ | |
&& apt-get autoremove -y \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment