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 ENV GOPATH /opt/gopath
# Run prebuild script (will prebuild stuff into the image if env var is set) # Run prebuild script (will prebuild stuff into the image if env var is set)
ADD prebuild.sh /opt/prebuild.sh ADD . /opt/syncthing-android
RUN /opt/prebuild.sh RUN /opt/syncthing-android/docker/prebuild.sh
WORKDIR /mnt WORKDIR /mnt

View File

@ -1,7 +1,15 @@
# How to use this # How to use this
1. Build the docker image: `docker build -t syncthing-android-builder:latest .` ## Create the builder image
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` From inside the checked out syncthing-android repository, run:
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 `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 #!/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" echo "Prepopulating gradle and go build/pkg cache"
git clone --recurse-submodules https://github.com/syncthing/syncthing-android
cd syncthing-android cd syncthing-android
./gradlew --no-daemon lint buildNative ./gradlew --no-daemon lint buildNative
cd .. cd ..