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

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

6 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 android/Dockerfile .
83 + --progress=plain \
84 + --file android/Dockerfile 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 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 android/Dockerfile .
12 +# --progress=plain \
13 +# --file android/Dockerfile android
13 14 #
14 −# Run from the repository root — the build context is the repo, so the
15 −# app sources are at `android/`.
15 +# Run from the repository root. The build context is `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 ARG JDK_IMAGE=eclipse-temurin:17-jdk
18 24
@@ -55,9 +61,9 @@ RUN yes | sdkmanager --licenses > /dev/null \
55 61 FROM sdk AS deps
56 62
57 63 WORKDIR /src
58 −COPY android/gradle ./gradle
59 −COPY android/gradlew android/settings.gradle.kts android/build.gradle.kts android/gradle.properties ./
60 −COPY android/app/build.gradle.kts ./app/
64 +COPY gradle ./gradle
65 +COPY gradlew settings.gradle.kts build.gradle.kts gradle.properties ./
66 +COPY app/build.gradle.kts ./app/
61 67
62 68 RUN echo "sdk.dir=${ANDROID_HOME}" > local.properties
63 69
@@ -72,7 +78,7 @@ RUN ./gradlew --no-daemon :app:dependencies --configuration releaseRuntimeClassp
72 78 FROM deps AS build
73 79
74 80 ARG BUILD_TOOLS=34.0.0
75 −COPY android/app ./app
81 +COPY app ./app
76 82
77 83 RUN ./gradlew --no-daemon :app:assembleRelease
78 84
modified android/README.md
+2 −1
@@ -249,7 +249,8 @@ reproduces it locally:
249 249 docker buildx build --target android-export \
250 250 --secret id=keystore,src=./release.jks \
251 251 --secret id=keystore_password,src=./keystore.pass \
252 − --output type=local,dest=./apk --file android/Dockerfile .
252 + --progress=plain \
253 + --output type=local,dest=./apk --file android/Dockerfile android
253 254 ```
254 255
255 256 The keystore is a BuildKit secret, so it never reaches a Gradle script,

Parents: d05f114