Docker images for Flutter Continuous Integration (CI). The source is available on GitHub.
The images includes the minimum tools to run Flutter and build apps. The versions of the tools installed are based on the official Flutter repository. The final goal is that Flutter doesn't need to download anything like tools or SDKs when running the container.
- Installed Flutter SDK 3.27.1.
- Analytics disabled by default, opt-in if
ENABLE_ANALYTICS
environment variable is passed when running the container. - Rootless user
flutter:flutter
, with permissions to run on Github workflows and GitLab CI. - Cached Fastlane gem 2.226.0.
- Minimal image with predownloaded SDKs and tools ready to run
flutter
commands for the Android platform.
Predownloaded SDKs and tools in Android:
- Licenses accepted
- Android SDK Platforms: 35
- Gradle: 8.3
The images are experimental and are in active development. They are being used for small projects but there is no confirmation of production usage yet.
Registries:
On the terminal:
# From Docker Hub
docker run --rm -it gmeligio/flutter-android:3.27.1 bash
# From GitHub Container Registry
docker run --rm -it ghcr.io/gmeligio/flutter-android:3.27.1 bash
# From Quay.io
docker run --rm -it quay.io/gmeligio/flutter-android:3.27.1 bash
On a workflow in GitHub Actions:
jobs:
build:
runs-on: ubuntu-22.04
container:
image: ghcr.io/gmeligio/flutter-android:3.27.1
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: flutter build apk
On a .gitlab-ci.yml
in GitLab CI:
build:
image: ghcr.io/gmeligio/flutter-android:3.27.1
script:
- flutter build apk
Fastlane:
# Ruby bundler is available in the container.
# The fastlane gem is cached but not installed
# For more information, see https://docs.fastlane.tools
# Use --prefer-local to download gems only if they are not cached
bundle install --prefer-local
bundle exec fastlane
There is no latest
Docker tag on purpose. You need to specify the version of the image you want to use. The reason for that is that latest
is a dynamic tag that can be confusing when reading the image URI because doesn't necessarily point to the latest image built and can cause unexpected behavior when rerunning a past CI job that runs with an overwritten latest tags. There are multiple articles explaining more about this reasoning like What's Wrong With The Docker :latest Tag? and The misunderstood Docker tag: latest.
The tag is composed of the Flutter version used to build the image. For example:
- Docker image: gmeligio/flutter-android:3.27.1
- Flutter version: 3.27.1
The Dockerfile expects a few parameters:
flutter_version <string>
: The version of Flutter to use when building. Example: 3.27.1android_build_tools_version <string>
: The version of the Android SDK Build Tools to install. Example: 33.0.1android_platform_versions <list>
: The versions of the Android SDK Platforms to install, separated by spaces. Example: 28 31 33
# Android
docker build --target android --build-arg flutter_version=3.27.1 --build-arg fastlane_version=2.226.0 --build-arg android_build_tools_version=33.0.1 --build-arg android_platform_versions="35" -t android-test .
The base image is debian/debian:12-slim
and from there multiple stages are created:
flutter
stage hast only the dependencies required to install flutter and common tools used by flutter internal commands, likegit
.fastlane
stage has the dependencies required to install fastlane but doesn't install fastlane.android
stage has the dependencies required to install the Android SDK and to develop Flutter apps for Android.
- Minimal image with predownloaded SDKs and tools ready to run
flutter
commands for the platforms:- iOS
- Linux
- Windows
- Web
- Android features:
- Android emulator
- Android NDK
The storage of the images starts to cost after 50 GB and increases with every pushed image because the AWS Free Tier covers up to 50 GB of total storage for free in ECR Public.
See Contributing.