2023-06-18 14:29:22 +00:00
|
|
|
FROM eclipse-temurin:11-jdk-jammy
|
2018-04-09 20:13:25 +00:00
|
|
|
|
2024-01-10 20:32:57 +00:00
|
|
|
ENV GO_VERSION 1.21.6
|
2021-07-07 12:36:33 +00:00
|
|
|
|
2022-11-27 19:27:54 +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
|
2018-04-09 20:13:25 +00:00
|
|
|
WORKDIR /opt
|
|
|
|
|
2023-06-18 08:02:18 +00:00
|
|
|
# The '--reinstall' combined with 'build-essentials' is necessary for cgo
|
|
|
|
# compilation of go std libs to work. A terrible, arcane hack to solve arkane
|
|
|
|
# cgo issues - almost fitting.
|
|
|
|
RUN apt-get update && apt-get install --reinstall --no-install-recommends -y build-essential gcc unzip git gnupg python3
|
2023-06-18 14:29:22 +00:00
|
|
|
|
2018-04-09 20:13:25 +00:00
|
|
|
# Install Go
|
2023-06-18 14:29:22 +00:00
|
|
|
RUN wget -nv https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
|
2018-04-09 20:13:25 +00:00
|
|
|
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}
|
2018-04-09 20:13:25 +00:00
|
|
|
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}"
|
|
|
|
|
2018-04-09 20:13:25 +00:00
|
|
|
# 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
|
2021-02-03 09:45:54 +00:00
|
|
|
|
2022-11-27 19:27:54 +00:00
|
|
|
# NDK version
|
2023-06-18 14:27:45 +00:00
|
|
|
ENV NDK_VERSION 25.2.9519653
|
2018-04-09 20:13:25 +00:00
|
|
|
|
|
|
|
# Install other android packages, including NDK
|
2023-09-12 20:46:16 +00:00
|
|
|
RUN $SDKMANAGER tools platform-tools "build-tools;33.0.2" "platforms;android-33" "extras;android;m2repository" "ndk;${NDK_VERSION}"
|
2018-04-09 20:13:25 +00:00
|
|
|
|
|
|
|
# Accept licenses of newly installed packages
|
2021-07-07 12:36:33 +00:00
|
|
|
RUN yes | $SDKMANAGER --licenses
|
2018-04-09 20:13:25 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2018-04-09 20:13:25 +00:00
|
|
|
# Run prebuild script (will prebuild stuff into the image if env var is set)
|
2023-06-18 14:45:01 +00:00
|
|
|
ADD . /opt/syncthing-android
|
|
|
|
RUN /opt/syncthing-android/docker/prebuild.sh
|
2018-04-09 20:13:25 +00:00
|
|
|
|
|
|
|
WORKDIR /mnt
|