1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 06:11:19 +00:00
syncthing-android/docker/Dockerfile

51 lines
1.6 KiB
Text
Raw Normal View History

2021-06-26 20:20:34 +00:00
FROM openjdk:11
2021-06-09 12:58:06 +00:00
ENV GO_VERSION 1.16.5
ENV ANDROID_SDK_VERSION 3859397
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/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip && \
unzip -q sdk-tools-linux-${ANDROID_SDK_VERSION}.zip && \
rm sdk-tools-linux-${ANDROID_SDK_VERSION}.zip
ENV ANDROID_HOME /opt/android-sdk
# Accept the SDK license, as we can't install packages otherwise
RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager --licenses > /dev/null
# NDK version (r22 fails to build)
ENV NDK_VERSION 21.4.7075529
# Install other android packages, including NDK
RUN ${ANDROID_HOME}/tools/bin/sdkmanager tools platform-tools "build-tools;29.0.3" "platforms;android-29" "extras;android;m2repository" "ndk;${NDK_VERSION}"
# Accept licenses of newly installed packages
RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager --licenses
# Setup the NDK path
ENV ANDROID_NDK_HOME ${ANDROID_HOME}/ndk/${NDK_VERSION}
# 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