-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Docker, Dependabot and GitHub Workflows (#1198)"
This reverts commit cf0a370.
- Loading branch information
1 parent
cf0a370
commit db32547
Showing
9 changed files
with
55 additions
and
279 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,41 @@ | ||
FROM eclipse-temurin:11-jdk-jammy | ||
FROM openjdk:8 | ||
|
||
ENV GO_VERSION 1.22.7 | ||
ENV GO_VERSION 1.11.4 | ||
ENV ANDROID_SDK_VERSION 4333796 | ||
|
||
# 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 | ||
|
||
# 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 | ||
|
||
# Install Go | ||
RUN wget -nv https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \ | ||
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} | ||
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 | ||
|
||
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 27.0.12077973 | ||
ENV TARGET_SDK_VERSION 35 | ||
RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager --licenses | ||
|
||
# Install other android packages, including NDK | ||
RUN $SDKMANAGER tools platform-tools "build-tools;${TARGET_SDK_VERSION}.0.0" "platforms;android-${TARGET_SDK_VERSION}" "extras;android;m2repository" "ndk;${NDK_VERSION}" | ||
RUN ${ANDROID_HOME}/tools/bin/sdkmanager tools platform-tools "build-tools;28.0.3" "platforms;android-28" "extras;android;m2repository" ndk-bundle | ||
|
||
# Accept licenses of newly installed packages | ||
RUN yes | $SDKMANAGER --licenses | ||
RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager --licenses | ||
|
||
# Setup the NDK path | ||
ENV ANDROID_NDK_HOME ${ANDROID_HOME}/ndk-bundle | ||
|
||
# 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 . /opt/syncthing-android | ||
RUN /opt/syncthing-android/docker/prebuild.sh | ||
ADD prebuild.sh /opt/prebuild.sh | ||
RUN /opt/prebuild.sh | ||
|
||
WORKDIR /mnt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
# How to use this | ||
|
||
## Create the builder image | ||
|
||
From inside the checked out syncthing-android repository, run: | ||
|
||
`docker build -t syncthing-android-builder:latest -f ./docker/Dockerfile .` | ||
|
||
## Build the app | ||
|
||
1. From inside the checked out syncthing-android repository, run: | ||
`git submodule init; git submodule update` | ||
2. Actual build: | ||
`docker run --rm -v /tmp/syncthing-android:/mnt syncthing-android-builder ./gradlew buildNative assembleDebug` | ||
3. Retrieve APKs from ./app/build/outputs | ||
1. Build the docker image: `docker build -t syncthing-android-builder:latest .` | ||
2. Checkout syncthing-android somewhere (for the sake of discussion let's say /tmp/syncthing-android) | ||
3. Inside /tmp/syncthing-android, do `git submodule init; git submodule update` | ||
4. Run `docker run --rm -v /tmp/syncthing-android:/mnt syncthing-android-builder ./gradlew buildNative assembleDebug` | ||
5. Retrieve APKs from /tmp/syncthing-android/app/build/outputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,41 @@ | ||
#!/bin/bash -e | ||
|
||
if [ -z "$SYNCTHING_ANDROID_PREBUILT" ]; then | ||
echo "Prebuild disabled" | ||
rm -rf syncthing-android | ||
exit 0 | ||
fi | ||
[ -z "$SYNCTHING_ANDROID_PREBUILT" ] && echo "Prebuild disabled" && exit 0 | ||
|
||
echo "Prepopulating gradle and go build/pkg cache" | ||
for ARCH in arm x86 arm64; do | ||
GOARCH=${ARCH} | ||
SDK=16 | ||
case ${ARCH} in | ||
arm) | ||
GCC="arm-linux-androideabi-clang" | ||
;; | ||
arm64) | ||
SDK=21 | ||
GCC="aarch64-linux-android-clang" | ||
;; | ||
x86) | ||
GOARCH=386 | ||
GCC="i686-linux-android-clang" | ||
;; | ||
*) | ||
echo "Invalid architecture" | ||
exit 1 | ||
esac | ||
|
||
STANDALONE_NDK_DIR="${ANDROID_NDK_HOME}/standalone-ndk/android-${SDK}-${GOARCH}" | ||
echo "Building standalone NDK - ${STANDALONE_NDK_DIR}" | ||
${ANDROID_NDK_HOME}/build/tools/make-standalone-toolchain.sh \ | ||
--platform=android-${SDK} --arch=${ARCH} \ | ||
--install-dir=${STANDALONE_NDK_DIR} | ||
|
||
echo "Pre-building Go standard library for $GOARCH" | ||
CGO_ENABLED=1 CC="${STANDALONE_NDK_DIR}/bin/${GCC}" \ | ||
GOOS=android GOARCH=$GOARCH go install -v std | ||
done | ||
|
||
echo "Prepopulating gradle cache" | ||
git clone https://github.com/syncthing/syncthing-android | ||
cd syncthing-android | ||
./gradlew --no-daemon lint buildNative | ||
./gradlew --no-daemon lint | ||
cd .. | ||
rm -rf syncthing-android |