Skip to content

Commit

Permalink
build(app): add Android setup with Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Sep 28, 2023
1 parent d93a36f commit a0cfb13
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,17 @@ flutter pub run flutter_launcher_icons:main
```

This will generate icons for both iOS as well as Android.

## Building with Docker for Android

Using `instrumentisto/flutter` to build (of course also possible locally, but
might not work due to conflicting Java/Gradle/... versions).

Add keys according to
[Flutter docs](https://docs.flutter.dev/deployment/android) and set the path in
`key.properties` to `/keystore/upload-keystore.jks` (this is where the
to-be-mounted volume points to; would recommend to keep the original path as a
comment for reference).

Execute the `build_android.sh` script:
`bash build_helpers/build_android.sh <path-to-keystore> <path-to-repository>`.
7 changes: 7 additions & 0 deletions app/build_helpers/android.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM instrumentisto/flutter:3.7.6
COPY . /app
RUN rm -rf /app/build
WORKDIR /app
RUN dart pub get
RUN flutter pub get
RUN flutter pub run build_runner build --delete-conflicting-outputs
12 changes: 12 additions & 0 deletions app/build_helpers/build_android.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Run this from the app project root
# Receives path to keystore and path to repository as parameters

output_path="app/build/app/outputs/bundle/release"
docker build -f build_helpers/android.Dockerfile -t build-pharme-for-android .
docker run \
-v $1:/keystore \
-v $2/$output_path:/$output_path \
build-pharme-for-android \
flutter build appbundle

0 comments on commit a0cfb13

Please sign in to comment.