# Release APK of the Android app for build.sh --mobile-version, at /tmail-qa.apk of the image. The # release key is not available here: the build is signed with a key generated in the image. The # caches survive the builds. ARG FLUTTER_VERSION=3.47.9 # instrumentisto/flutter is archived and has no 3.47.9 tag; gmeligio tracks current stable. # Digest pins the linux/amd64 manifest (digest wins over the tag). FROM --platform=amd64 ghcr.io/gmeligio/flutter-android:${FLUTTER_VERSION}@sha256:e7691a1786814ed319c6e3e411b9416e1162a49f7af33fee7cfedf2c38e40ee3 AS build-env # Image defaults to user flutter; root only for COPY ownership and keystore setup. USER root WORKDIR /app COPY --chown=flutter:flutter . . # local.properties and key.properties of the checkout would point at the host's SDK and key RUN rm -f android/local.properties android/key.properties && \ keytool -genkeypair -keystore /home/flutter/qa.keystore -storepass android -alias qa -keypass android \ -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Twake QA,O=Linagora,C=FR" 2>/dev/null && \ printf 'storeFile=/home/flutter/qa.keystore\nstorePassword=android\nkeyAlias=qa\nkeyPassword=android\n' \ > android/key.properties && \ chown flutter:flutter /app /home/flutter/qa.keystore android/key.properties USER flutter # gmeligio images use uid/gid 1001 for the flutter user; fresh cache mounts # are root-owned 0755 otherwise, so pub get / gradle fail as flutter. # Do not cache-mount the NDK path: an empty mount would hide the image's # preinstalled NDK and force a large re-download on first build. RUN --mount=type=cache,uid=1001,gid=1001,target=/home/flutter/.pub-cache \ --mount=type=cache,uid=1001,gid=1001,target=/home/flutter/.gradle \ ./scripts/prebuild.sh && \ flutter build apk --release && \ mkdir /home/flutter/out && cp build/app/outputs/flutter-apk/app-release.apk /home/flutter/out/tmail-qa.apk FROM scratch COPY --from=build-env /home/flutter/out/tmail-qa.apk /