syncthing-android/docker/Dockerfile

52 lines
1.6 KiB
Docker
Raw Normal View History

2021-06-26 20:20:34 +00:00
FROM openjdk:11
2023-06-17 12:00:58 +00:00
ENV GO_VERSION 1.19.10
2021-07-07 12:36:33 +00:00
# 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 && \
2021-07-07 12:36:33 +00:00
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
2021-07-07 12:36:33 +00:00
ARG SDKMANAGER="${ANDROID_HOME}/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_HOME}"
# Accept the SDK license, as we can't install packages otherwise
2021-07-07 12:36:33 +00:00
RUN yes | $SDKMANAGER --licenses > /dev/null
# NDK version
2022-11-27 20:33:37 +00:00
ENV NDK_VERSION 25.1.8937393
# Install other android packages, including NDK
RUN $SDKMANAGER tools platform-tools "build-tools;32.0.0" "platforms;android-32" "extras;android;m2repository" "ndk;${NDK_VERSION}"
# Accept licenses of newly installed packages
2021-07-07 12:36:33 +00:00
RUN yes | $SDKMANAGER --licenses
# Enable prebuild mode
ENV SYNCTHING_ANDROID_PREBUILT 1
2019-09-05 13:58:51 +00:00
# Set location of go cache
ENV GOCACHE /opt/gocache
2019-09-05 15:25:15 +00:00
# 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