Add android dockerfile #9090

Open
cortadocodes wants to merge 1 commit from cortadocodes/create-reproducible-build-dockerfile into master

34
android/docker/Dockerfile Normal file
View file

@ -0,0 +1,34 @@
FROM ubuntu:24.04@sha256:2e863c44b718727c860746568e1d54afd13b2fa71b160f5cd9058fc436217b30
RUN apt-get update \
&& apt-get install -y git openjdk-17-jdk unzip wget gcc g++ \
&& rm -rf /var/lib/apt/lists/*
ENV ANDROID_COMMAND_LINE_TOOLS_FILENAME commandlinetools-linux-10406996_latest.zip
ENV ANDROID_API_LEVELS android-34
ENV ANDROID_BUILD_TOOLS_VERSION 34.0.0
biodranik commented 2024-08-25 11:24:16 +00:00 (Migrated from github.com)
Review
  1. These variables and their values should be taken from the repo, to avoid copy-paste and sync issues.
  2. Can Dockerfile be in the root folder? Why is it in the docker subfolder?
1. These variables and their values should be taken from the repo, to avoid copy-paste and sync issues. 2. Can Dockerfile be in the root folder? Why is it in the docker subfolder?
ENV ANDROID_HOME /usr/local/android-sdk-linux
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmdline-tools/bin
RUN cd /usr/local/
RUN wget -q "https://dl.google.com/android/repository/${ANDROID_COMMAND_LINE_TOOLS_FILENAME}"
biodranik commented 2024-08-25 11:26:55 +00:00 (Migrated from github.com)
Review

Won't sudo snap install androidsdk work?

Won't `sudo snap install androidsdk` work?
RUN unzip ${ANDROID_COMMAND_LINE_TOOLS_FILENAME} -d /usr/local/android-sdk-linux
RUN rm ${ANDROID_COMMAND_LINE_TOOLS_FILENAME}
RUN yes | sdkmanager --update --sdk_root="${ANDROID_HOME}"
RUN yes | sdkmanager --sdk_root="${ANDROID_HOME}" "platforms;${ANDROID_API_LEVELS}" "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "extras;google;m2repository" "extras;android;m2repository" "extras;google;google_play_services" "ndk;26.3.11579264" "cmake;3.22.1"
biodranik commented 2024-08-25 11:28:44 +00:00 (Migrated from github.com)
Review
  1. Aren't these dependencies downloaded/installed automatically when the project is built?
  2. Caching already downloaded sdk dependencies will save time on failed/repeated builds.
  3. Please avoid hard-coding anything here, for example, the ndk version has just been updated in #9087
1. Aren't these dependencies downloaded/installed automatically when the project is built? 2. Caching already downloaded sdk dependencies will save time on failed/repeated builds. 3. Please avoid hard-coding anything here, for example, the ndk version has just been updated in #9087
RUN yes | sdkmanager --licenses --sdk_root="${ANDROID_HOME}"
RUN rm -rf ${ANDROID_HOME}/tools
RUN git config --global --add safe.directory /project
biodranik commented 2024-08-25 11:29:00 +00:00 (Migrated from github.com)
Review

Why is it needed? Clarifying comments would help a lot.

Why is it needed? Clarifying comments would help a lot.
WORKDIR /build
COPY . .
WORKDIR /build/android
RUN ./gradlew assembleFdroidBeta -Parm64 && ./gradlew clean
biodranik commented 2024-08-25 11:30:51 +00:00 (Migrated from github.com)
Review
  1. assembleWebBeta is preferred, it will work better with network location.
  2. is there any benefit in clean?
1. assembleWebBeta is preferred, it will work better with network location. 2. is there any benefit in clean?