45 lines
2.4 KiB
Docker
45 lines
2.4 KiB
Docker
FROM archlinux:latest
|
|
|
|
ARG YESACCEPT=n
|
|
RUN echo "this is $YESACCEPT"
|
|
RUN pacman -Syu --noconfirm
|
|
RUN pacman -S --noconfirm coreutils bash shadow make unzip zip jdk17-openjdk wget
|
|
ENV ANDROID_SDK_ROOT="/opt/android"
|
|
ENV BUILD_TOOLS_LATEST="$ANDROID_SDK_ROOT/cmdline-tools/latest"
|
|
RUN BUILD_TOOLS="$(realpath -m "$BUILD_TOOLS_LATEST/..")";\
|
|
mkdir -p "$BUILD_TOOLS";\
|
|
cd "$BUILD_TOOLS";\
|
|
pwd;\
|
|
for LATESTTOOLS in \
|
|
"$(curl https://developer.android.com/studio#command-line-tools-only | grep -e 'https://dl.google.com/android/repository/commandlinetools-linux-.*_latest.zip' | cut -f2 -d'"')" \
|
|
'https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip' ;\
|
|
do \
|
|
echo "testing to get '$LATESTTOOLS'";\
|
|
echo test "${LATESTTOOLS:0:22}" = "https://dl.google.com/" -a "${LATESTTOOLS:(-11)}" = "_latest.zip" ;\
|
|
test "${LATESTTOOLS:0:22}" = "https://dl.google.com/" -a "${LATESTTOOLS:(-11)}" = "_latest.zip" || { echo "unsure of URL $LATESTTOOLS correct, skipping it..." >&2; continue; }; \
|
|
wget -O cmdline-tools.zip "$LATESTTOOLS" ;\
|
|
unzip cmdline-tools.zip && break || { echo "error downloading working cmdline-tools.zip"; exit 1; };\
|
|
done;\
|
|
ls ;\
|
|
ls cmdline-tools;\
|
|
rm cmdline-tools.zip;\
|
|
mv -v cmdline-tools "$BUILD_TOOLS_LATEST" || true
|
|
ENV PATH="$PATH:$BUILD_TOOLS_LATEST/bin"
|
|
#TODO make this automatic
|
|
ENV JAVA_HOME="/usr/lib/jvm/java-17-openjdk/"
|
|
ENV LIBRARY_PATH="$LIBRARY_PATH:$BUILD_TOOLS_LATEST/lib"
|
|
RUN test "$YESACCEPT" = "y" || { printf "\033[31;1;4m%s\n%s\033[0m " "FAILED TO BUILD CONTAINER: You did not ACCEPT THE UPSTREAM LICENSE" " -> export YESACCEPT=y" >&2; exit 1; }
|
|
RUN echo you selected to accept the licenses/TOS
|
|
RUN echo "$YESACCEPT" | sdkmanager --install "build-tools;33.0.2"
|
|
RUN echo "$YESACCEPT" | sdkmanager --install "platforms;android-33"
|
|
RUN echo "$YESACCEPT" | sdkmanager --install "ndk;28.0.12433566"
|
|
#RUN echo "$YESACCEPT" | sdkmanager --install "system-images;android-33;aosp_atd;x86_64"
|
|
#RUN echo "$YESACCEPT" | sdkmanager --install "emulator"
|
|
#RUN echo "no" | avdmanager --verbose create avd --force --name "thedevice" --package 'system-images;android-33;aosp_atd;x86_64' --tag "aosp_atd" --abi "x86_64"
|
|
#RUN echo "$YESACCEPT" | sdkmanager --install "platform-tools"
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chown 0:0 /entrypoint.sh
|
|
RUN chmod 0700 /entrypoint.sh
|
|
WORKDIR /apk
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
RUN echo "$YESACCEPT" | tee yesaccept
|