Add android dockerfile #9090
1 changed files with 34 additions and 0 deletions
34
android/docker/Dockerfile
Normal file
34
android/docker/Dockerfile
Normal 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
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?
|
||||
|
||||
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}"
|
||||
![]() Won't 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"
|
||||
![]()
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
|
||||
![]() 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
|
||||
![]()
1. assembleWebBeta is preferred, it will work better with network location.
2. is there any benefit in clean?
|
Reference in a new issue