1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-25 05:41:15 +00:00

Prebuild in docker image based on local copy of repo

Instead of checking out the default branch. Otherwise it's impossible to
test local changes.
This commit is contained in:
Simon Frei 2023-06-18 16:45:01 +02:00
parent 4ef201b0a8
commit d753c2659f
No known key found for this signature in database
GPG key ID: 7C31D23ECB1006F3
3 changed files with 20 additions and 9 deletions

View file

@ -47,7 +47,7 @@ ENV GOCACHE /opt/gocache
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
ADD . /opt/syncthing-android
RUN /opt/syncthing-android/docker/prebuild.sh
WORKDIR /mnt

View file

@ -1,7 +1,15 @@
# How to use this
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
## 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

View file

@ -1,9 +1,12 @@
#!/bin/bash -e
[ -z "$SYNCTHING_ANDROID_PREBUILT" ] && echo "Prebuild disabled" && exit 0
if [ -z "$SYNCTHING_ANDROID_PREBUILT" ]; then
echo "Prebuild disabled"
rm -rf syncthing-android
exit 0
fi
echo "Prepopulating gradle and go build/pkg cache"
git clone --recurse-submodules https://github.com/syncthing/syncthing-android
cd syncthing-android
./gradlew --no-daemon lint buildNative
cd ..