Skip to content

gmeligio/flutter-docker-image

Repository files navigation

openssf scorecard channel flutter-android version flutter-android pulls

Flutter Docker Image

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.

Contents

Features

  • Installed Flutter SDK 3.32.2.
  • 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.227.2.
  • 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
  • Android NDK: 26.3.11579264
  • Gradle: 8.12

Running Containers

Registry flutter-android
Docker Hub gmeligio/flutter-android:3.32.2
GitHub Container Registry ghcr.io/gmeligio/flutter-android:3.32.2
Quay quay.io/gmeligio/flutter-android:3.32.2

On the terminal:

# From GitHub Container Registry
docker run --rm -it ghcr.io/gmeligio/flutter-android:3.32.2 bash

On a workflow in GitHub Actions:

jobs:
  build:
    runs-on: ubuntu-22.04
    container:
      image: ghcr.io/gmeligio/flutter-android:3.32.2
    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.32.2
  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

Tags

Every new tag on the flutter stable channel gets built. The tag is composed of the Flutter version used to build the image:

  • Docker image: gmeligio/flutter-android:3.32.2
  • Flutter version: 3.32.2

Building Locally

The android.Dockerfile expects a few arguments:

  • flutter_version <string>: The version of Flutter to use when building. Example: 3.32.2
  • android_build_tools_version <string>: The version of the Android SDK Build Tools to install. Example: 34.0.0
  • android_platform_versions <list>: The versions of the Android SDK Platforms to install, separated by spaces. Example: 35
# Android
docker build --target android --build-arg flutter_version=3.32.2 --build-arg fastlane_version=2.227.2 --build-arg android_build_tools_version=34.0.0 --build-arg android_platform_versions="35" -t android-test .

Roadmap

  • Minimal image with predownloaded SDKs and tools ready to run flutter commands for the platforms:
    • iOS
    • Linux
    • Windows
    • Web
  • Android features:
    • Android emulator

FAQ

Why the images are not published in the AWS ECR Public registry?

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.

Why there is no dynamic tag like latest?

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 can cause unexpected behavior when rerunning a past CI job that was expected to use the old build of the latest tag. There are multiple articles explaining more about this reasoning like What's Wrong With The Docker :latest Tag? and The misunderstood Docker tag: latest.

Contributing

See Contributing.

License

Flutter is licensed under BSD 3-Clause "New" or "Revised" license.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

The sources for producing gmeligio/flutter-android Docker images are licensed under MIT License.

About

Docker images for Flutter Continuous Integration (CI)

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 5