1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-22 12:21:15 +00:00
syncthing-android/docker/Dockerfile
Simon Frei 2942072594
Compile and target SDK version 31, increase min Sdk to 21 (#1864)
The upgraded compile SDK requires an upgrade of gradle, which introduces a
build error with api lvl <21:
   > Error while processing [...]/app/src/main/res/drawable/ic_close_24dp.xml :
     Invalid color value ?attr/colorControlNormal
Explanation: https://stackoverflow.com/a/49501629

Also minor NDK update
2022-11-27 20:27:54 +01:00

51 lines
1.6 KiB
Docker

FROM openjdk:11
ENV GO_VERSION 1.19.3
# Can be found scrolling down on this page:
# https://developer.android.com/studio/index.html#command-tools
ARG ANDROID_SDK_FILENAME=commandlinetools-linux-9123335_latest.zip
WORKDIR /opt
# Install Go
RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
tar -zxf go${GO_VERSION}.linux-amd64.tar.gz && \
rm go${GO_VERSION}.linux-amd64.tar.gz
ENV GOROOT /opt/go
ENV PATH /opt/go/bin:${PATH}
# Install Android SDK manager
RUN mkdir -p /opt/android-sdk && cd /opt/android-sdk && \
wget -q https://dl.google.com/android/repository/${ANDROID_SDK_FILENAME} && \
unzip -q ${ANDROID_SDK_FILENAME} && \
rm ${ANDROID_SDK_FILENAME}
ENV ANDROID_HOME /opt/android-sdk
ARG SDKMANAGER="${ANDROID_HOME}/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_HOME}"
# Accept the SDK license, as we can't install packages otherwise
RUN yes | $SDKMANAGER --licenses > /dev/null
# NDK version
ENV NDK_VERSION 23.2.8568313
# Install other android packages, including NDK
RUN $SDKMANAGER tools platform-tools "build-tools;31.0.0" "platforms;android-31" "extras;android;m2repository" "ndk;${NDK_VERSION}"
# Accept licenses of newly installed packages
RUN yes | $SDKMANAGER --licenses
# Enable prebuild mode
ENV SYNCTHING_ANDROID_PREBUILT 1
# Set location of go cache
ENV GOCACHE /opt/gocache
# Set location of GOPATH to persist packages for module builds in GOPATH/pkg/mod
ENV GOPATH /opt/gopath
# Run prebuild script (will prebuild stuff into the image if env var is set)
ADD prebuild.sh /opt/prebuild.sh
RUN /opt/prebuild.sh
WORKDIR /mnt