Build the APK from the app directory, not the repository root

c04adc5 · Gabriel Morell · 2026-09-12 20:50

7 files +17 -9
Message
{commit_body(@commit)}

Files changed

modified .forgejo/workflows/android.yml
+2 −1
@@ -80,7 +80,8 @@ jobs:
80 80 --secret id=keystore,src=./release.jks \
81 81 --secret id=keystore_password,src=./keystore.pass \
82 82 --output type=local,dest=./apk \
83 − --file clients/android/Dockerfile .
83 + --progress=plain \
84 + --file clients/android/Dockerfile clients/android
84 85
85 86 # The keystore is gone before anything else runs, so a later step
86 87 # or a failure mid-job can't leave it on a persistent runner.
modified clients/android/Dockerfile
+13 −7
@@ -9,10 +9,16 @@
9 9 # --secret id=keystore,src=./release.jks \
10 10 # --secret id=keystore_password,src=./keystore.pass \
11 11 # --output type=local,dest=./apk \
12 −# --file clients/android/Dockerfile .
12 +# --progress=plain \
13 +# --file clients/android/Dockerfile clients/android
13 14 #
14 −# Run from the repository root — the build context is the repo, so the
15 −# app sources are at `clients/android/`.
15 +# Run from the repository root. The build context is `clients/android`, not the
16 +# repository: the app needs nothing from outside it, and the root
17 +# .dockerignore in several of these repos excludes `android/` so the
18 +# service image doesn't drag the Gradle wrapper and SDK caches along.
19 +# With a repo-root context BuildKit is handed a tree with the app
20 +# filtered out of it, and the COPY below fails as a bare glob error
21 +# with no step log to explain itself.
16 22
17 23 # JDK 21 rather than 17, and a current cmdline-tools: AGP 9.2 / Gradle
18 24 # 9.4 here, compiling against android-36.1. The 2024-era tools pinned
@@ -58,9 +64,9 @@ RUN yes | sdkmanager --licenses > /dev/null \
58 64 FROM sdk AS deps
59 65
60 66 WORKDIR /src
61 −COPY clients/android/gradle ./gradle
62 −COPY clients/android/gradlew clients/android/settings.gradle.kts clients/android/build.gradle.kts clients/android/gradle.properties ./
63 −COPY clients/android/app/build.gradle.kts ./app/
67 +COPY gradle ./gradle
68 +COPY gradlew settings.gradle.kts build.gradle.kts gradle.properties ./
69 +COPY app/build.gradle.kts ./app/
64 70
65 71 RUN echo "sdk.dir=${ANDROID_HOME}" > local.properties
66 72
@@ -75,7 +81,7 @@ RUN ./gradlew --no-daemon :app:dependencies --configuration releaseRuntimeClassp
75 81 FROM deps AS build
76 82
77 83 ARG BUILD_TOOLS=36.1.0
78 −COPY clients/android/app ./app
84 +COPY app ./app
79 85
80 86 RUN ./gradlew --no-daemon :app:assembleRelease
81 87
modified clients/android/README.md
+2 −1
@@ -194,7 +194,8 @@ reproduces it locally:
194 194 docker buildx build --target android-export \
195 195 --secret id=keystore,src=./release.jks \
196 196 --secret id=keystore_password,src=./keystore.pass \
197 − --output type=local,dest=./apk --file clients/android/Dockerfile .
197 + --progress=plain \
198 + --output type=local,dest=./apk --file clients/android/Dockerfile clients/android
198 199 ```
199 200
200 201 The keystore is a BuildKit secret, so it never reaches a Gradle script,

Parents: 2c049d8