├── .cirrus.yml ├── .github └── workflows │ └── check_flutter_versions.yml ├── .gitignore ├── LICENSE ├── README.md ├── ci.sh ├── scripts └── update_flutter_versions.sh └── sdk └── Dockerfile /.cirrus.yml: -------------------------------------------------------------------------------- 1 | env: 2 | GITHUB_TOKEN: ENCRYPTED[!82ed873afdf627284305afef4958c85a8f73127b09978a9786ac521559630ea6c9a5ab6e7f8315abf9ead09b6eff6eae!] 3 | docker_builder: 4 | name: flutter:$DOCKER_TAG 5 | env: 6 | # from https://flutter.dev/docs/development/tools/sdk/releases 7 | matrix: 8 | - DOCKER_TAG: latest 9 | FLUTTER_VERSION: 3.38.5 10 | - DOCKER_TAG: stable 11 | FLUTTER_VERSION: 3.38.5 12 | - DOCKER_TAG: beta 13 | FLUTTER_VERSION: 3.40.0-0.1.pre 14 | version_script: docker --version 15 | setup_script: 16 | - docker buildx create --name multibuilder 17 | - docker buildx use multibuilder 18 | - docker buildx inspect --bootstrap 19 | ci_script: ./ci.sh 20 | -------------------------------------------------------------------------------- /.github/workflows/check_flutter_versions.yml: -------------------------------------------------------------------------------- 1 | name: "Check Flutter versions" 2 | on: 3 | schedule: 4 | # Every 2 hours 5 | - cron: "0 */2 * * *" 6 | workflow_dispatch: 7 | 8 | jobs: 9 | check_versions: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | contents: write 13 | pull-requests: write 14 | steps: 15 | - uses: actions/checkout@v4 16 | 17 | # Install yq and jq 18 | - name: Install yq and jq 19 | run: | 20 | mkdir -p ~/bin 21 | wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O ~/bin/yq 22 | chmod +x ~/bin/yq 23 | echo "$HOME/bin" >> $GITHUB_PATH 24 | 25 | sudo apt-get install -y jq curl 26 | 27 | - name: Check for new Flutter versions 28 | run: sh scripts/update_flutter_versions.sh 29 | 30 | # Create a Pull Request if there are any changes. 31 | # This is automatically checked internally 32 | - name: Create Pull Request 33 | uses: peter-evans/create-pull-request@v6 34 | with: 35 | commit-message: "chore: Update Flutter version" 36 | title: "chore: Update Flutter version" 37 | branch: "chore/update-flutter-version" 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Cirrus Labs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker Images for [Flutter](https://flutter.dev/) 2 | 3 | [![Build Status][build_badge]][build_link] 4 | 5 | You can either [use it in CI](https://cirrus-ci.org/examples/#flutter) or run locally via Docker: 6 | 7 | ```bash 8 | docker run --rm -it -v ${PWD}:/build --workdir /build ghcr.io/cirruslabs/flutter:stable flutter test 9 | ``` 10 | 11 | The example above simply mount current working directory and runs `flutter test` 12 | 13 | ## GitHub Container Registry 14 | 15 | https://github.com/cirruslabs/docker-images-flutter/pkgs/container/flutter 16 | 17 | [build_badge]: https://api.cirrus-ci.com/github/cirruslabs/docker-images-flutter.svg 18 | [build_link]: https://cirrus-ci.com/github/cirruslabs/docker-images-flutter 19 | -------------------------------------------------------------------------------- /ci.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | if [ "$CIRRUS_BRANCH" != "master" ] 6 | then 7 | docker buildx build --platform linux/amd64,linux/arm64 \ 8 | --tag ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION/+/-} \ 9 | --tag ghcr.io/cirruslabs/flutter:$DOCKER_TAG \ 10 | --build-arg flutter_version=$FLUTTER_VERSION \ 11 | sdk 12 | exit 0 13 | fi 14 | 15 | echo $GITHUB_TOKEN | docker login ghcr.io -u fkorotkov --password-stdin 16 | 17 | docker buildx build --platform linux/amd64,linux/arm64 --push \ 18 | --tag ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION/+/-} \ 19 | --tag ghcr.io/cirruslabs/flutter:$DOCKER_TAG \ 20 | --build-arg flutter_version=$FLUTTER_VERSION \ 21 | sdk 22 | -------------------------------------------------------------------------------- /scripts/update_flutter_versions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # This script fetches the latest version of a the stable and beta flutter channels 5 | # and edits the .cirrus.yml file with those versions 6 | 7 | releases_json=$(curl -s https://storage.googleapis.com/flutter_infra_release/releases/releases_linux.json) 8 | 9 | # This function edits the .cirrus.yml file with the given flutter version for the given docker tag 10 | edit_cirrus_file_for_tag() { 11 | cirrus_file=".cirrus.yml" 12 | docker_tag=$1 13 | version=$2 14 | 15 | # env for yq 16 | docker_tag=$docker_tag version=$version \ 17 | yq -i '(.docker_builder.env.matrix[] | select(.DOCKER_TAG == env(docker_tag)) | .FLUTTER_VERSION) = env(version)' $cirrus_file 18 | } 19 | 20 | # This function fetches the latest version of a particular channel (stable, beta) for Flutter 21 | get_latest_version_in_channel() { 22 | channel=$1 23 | # This contains the hash of the latest version in the channel 24 | channel_hash=$(echo "$releases_json" | jq -r '.current_release.'"$channel") 25 | # Look for the version corresponding to the hash in the list of releases 26 | version=$(echo "$releases_json" | jq -r --arg HASH "$channel_hash" \ 27 | '.releases[] | select(.hash == $HASH).version') 28 | 29 | # check not empty 30 | if [ -z "$version" ]; then 31 | echo "Error fetching latest version in channel $channel" 32 | exit 1 33 | fi 34 | 35 | echo "$version" 36 | } 37 | 38 | stable_version=$(get_latest_version_in_channel "stable") 39 | beta_version=$(get_latest_version_in_channel "beta") 40 | 41 | echo "Latest beta version: $beta_version" 42 | echo "Latest stable version: $stable_version" 43 | 44 | edit_cirrus_file_for_tag "stable" "$stable_version" 45 | edit_cirrus_file_for_tag "latest" "$stable_version" 46 | edit_cirrus_file_for_tag "beta" "$beta_version" 47 | 48 | exit 0 49 | -------------------------------------------------------------------------------- /sdk/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ghcr.io/cirruslabs/android-sdk:36 2 | 3 | LABEL org.opencontainers.image.source=https://github.com/cirruslabs/docker-images-flutter 4 | USER root 5 | 6 | ARG flutter_version 7 | 8 | ENV FLUTTER_HOME=${HOME}/sdks/flutter \ 9 | FLUTTER_VERSION=$flutter_version 10 | ENV FLUTTER_ROOT=$FLUTTER_HOME 11 | 12 | ENV PATH ${PATH}:${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin 13 | 14 | RUN git clone --depth 1 --branch ${FLUTTER_VERSION} https://github.com/flutter/flutter.git ${FLUTTER_HOME} 15 | 16 | RUN yes | flutter doctor --android-licenses \ 17 | && flutter doctor \ 18 | && chown -R root:root ${FLUTTER_HOME} 19 | 20 | RUN flutter precache --android 21 | --------------------------------------------------------------------------------