Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 129 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,96 +1,181 @@
Flutter Docker image
====================
Flutter Docker Image (Multi-Arch)
====================================

[![Release](https://img.shields.io/github/v/release/instrumentisto/flutter-docker-image "Release")](https://github.com/instrumentisto/flutter-docker-image/releases)
[![CI](https://github.com/instrumentisto/flutter-docker-image/actions/workflows/ci.yml/badge.svg?branch=main "CI")](https://github.com/instrumentisto/flutter-docker-image/actions?query=workflow%3ACI+branch%3Amain)
[![Docker Hub](https://img.shields.io/docker/pulls/instrumentisto/flutter?label=Docker%20Hub%20pulls "Docker Hub pulls")](https://hub.docker.com/r/instrumentisto/flutter)
[![CI](https://github.com/opsdev-ws/flutter-docker-image/actions/workflows/build-push.yml/badge.svg?branch=main "CI")](https://github.com/opsdev-ws/flutter-docker-image/actions?query=workflow%3A%22Build+and+Push+Flutter+Image%22+branch%3Amain)

[Docker Hub](https://hub.docker.com/r/instrumentisto/flutter)
| [GitHub Container Registry](https://github.com/orgs/instrumentisto/packages/container/package/flutter)
| [Quay.io](https://quay.io/repository/instrumentisto/flutter)
**Multi-architecture Flutter Docker image supporting ARM64 and AMD64**

[Changelog](https://github.com/instrumentisto/flutter-docker-image/blob/main/CHANGELOG.md)
[GitHub Container Registry](https://github.com/orgs/opsdev-ws/packages?repo_name=flutter-docker-image)

Based on [`ghcr.io/cirruslabs/android-sdk` Docker image][2].

> **Note**: This is a fork of [instrumentisto/flutter-docker-image][90] optimized for:
> - **ARM64 support** (linux/arm64, linux/amd64)
> - **Web + Android builds** (Linux desktop toolchain removed)
> - **Non-root user compatibility** (UID 1000)
> - **Lighter image size** (removed unnecessary build tools)


## Supported Platforms

## Supported tags and respective `Dockerfile` links
- **linux/amd64** (Intel/AMD 64-bit)
- **linux/arm64** (ARM 64-bit - Apple Silicon, AWS Graviton, etc.)

- [`3.38.5-androidsdk36-r0`, `3.38.5`, `3.38`, `3`, `latest`][201]

## Supported Tags

- `3.38.5`, `latest` - Flutter 3.38.5 with Android SDK 36


## Supported toolchains

- `Android`
- `Linux`
- `Web`

## Supported Toolchains

- ✅ **Android** - Full Android SDK for mobile app builds
- ✅ **Web** - Web development support
- ❌ **Linux Desktop** - Removed to reduce image size (not needed for web/mobile)


## What is [Flutter]?

[Flutter] is Google's UI toolkit for building beautiful, natively compiled applications for mobile, web, desktop, and embedded devices from a single codebase.
This image contains all the necessary toolkit fot building [Flutter] applications.

This image contains the necessary toolkit for building [Flutter] applications for **Android** and **Web** platforms.

> [flutter.dev](https://flutter.dev)

![Flutter Logo](https://flutter.dev/assets/images/shared/brand/flutter/logo/flutter-lockup.png)


## How to Use This Image

### Pull the Image

```bash
# Pull latest version
docker pull ghcr.io/opsdev-ws/flutter:latest

# Pull specific version
docker pull ghcr.io/opsdev-ws/flutter:3.38.5
```

## How to use this image
### Run Flutter Commands

Mount your project directory and run the necessary `flutter` command:

```bash
docker run --rm -v /my/rust/project:/app -w /app instrumentisto/flutter \
docker run --rm -v /my/flutter/project:/app -w /app ghcr.io/opsdev-ws/flutter:3.38.5 \
flutter doctor
```

### Build a Flutter Web App

### Non-`root` usage
```bash
docker run --rm -v $(pwd):/app -w /app ghcr.io/opsdev-ws/flutter:3.38.5 \
flutter build web --dart-define BASE_URL=/api
```

### Build a Flutter Android App

If you cannot run this image as `root`, use the `1000` user instead, which owns `flutter_tools` inside the image:
```bash
docker run --rm --user 1000:1000 \
-v /my/rust/project:/app -w /app instrumentisto/flutter \
flutter doctor
docker run --rm -v $(pwd):/app -w /app ghcr.io/opsdev-ws/flutter:3.38.5 \
flutter build apk --release
```


## Non-Root Usage

**This image is designed for non-root usage!** Run as user `1000:1000`:

## Image tags
```bash
docker run --rm --user 1000:1000 \
-v /my/flutter/project:/app -w /app ghcr.io/opsdev-ws/flutter:3.38.5 \
flutter doctor
```

**Key Features for Non-Root:**
- Git repository permissions configured for all users
- Flutter cache directories writable by UID 1000
- No permission errors when running `flutter doctor`


### `<X>`
## Multi-Architecture Support

Latest tag of the latest major `X` [Flutter] version.
This image is built for multiple architectures:

```bash
# Verify multi-arch manifest
docker manifest inspect ghcr.io/opsdev-ws/flutter:3.38.5
```

### `<X.Y>`
**Automatic Platform Selection:**
Docker automatically pulls the correct architecture for your system:
- Apple Silicon Macs → `linux/arm64`
- Intel/AMD systems → `linux/amd64`
- AWS Graviton → `linux/arm64`
- GitLab ARM64 runners → `linux/arm64`


## Using in CI/CD

### GitLab CI Example

```yaml
test:
stage: test
image: ghcr.io/opsdev-ws/flutter:3.38.5
before_script:
- flutter pub get
script:
- flutter analyze
- flutter test
tags:
- docker # Works on both x86_64 and ARM64 runners
```

Latest tag of the latest minor `X.Y` [Flutter] version.
### GitHub Actions Example

```yaml
jobs:
test:
runs-on: ubuntu-latest
container:
image: ghcr.io/opsdev-ws/flutter:3.38.5
steps:
- uses: actions/checkout@v4
- run: flutter pub get
- run: flutter test
```


### `<X.Y.Z>`
## Image Details

Latest tag of the concrete `X.Y.Z` [Flutter] version.
### Included Tools

- **Flutter SDK** (installed via git clone for multi-arch support)
- **Dart SDK** (automatically downloaded for target architecture)
- **Android SDK** (API level 36)
- **Git** (for Flutter repository management)

### `<X.Y.Z>-androidsdk<A>-r<N>`
### What's Different from instrumentisto/flutter?

Concrete `N` image revision tag of the concrete `X.Y.Z` [Flutter] version with the concrete `A` API level version of [Android SDK].
| Feature | opsdev-ws/flutter | instrumentisto/flutter |
|---------|-------------------|------------------------|
| ARM64 Support | ✅ Yes | ❌ No |
| AMD64 Support | ✅ Yes | ✅ Yes |
| Linux Desktop Toolchain | ❌ Removed | ✅ Included |
| Non-root Compatible | ✅ Fully tested | ⚠️ Partial |
| Installation Method | Git clone | Tarball download |
| Image Size | Smaller | Larger |

Once built, it's never updated.

## Building Locally

```bash
# Build for your current architecture
docker build -t flutter:local .

# Build multi-arch (requires Docker Buildx)
docker buildx build --platform linux/amd64,linux/arm64 -t flutter:multi .
```


## License
Expand All @@ -101,29 +186,27 @@ As with all Docker images, these likely also contain other software which may be

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][90] for producing `instrumentisto/flutter` Docker images are licensed under [Blue Oak Model License 1.0.0][91].


This repository is a fork of [instrumentisto/flutter-docker-image][90] and maintains compatibility with its licensing terms.


## Issues

We can't notice comments in the [DockerHub] (or other container registries) so don't use them for reporting issue or asking question.

If you have any problems with or questions about this image, please contact us through a [GitHub issue][80].


## Credits

This project is a fork of [instrumentisto/flutter-docker-image][90], modified to add ARM64 support and optimize for web/Android builds.

Special thanks to the original [instrumentisto][95] team for creating the base Flutter Docker image.


[Android SDK]: https://developer.android.com/studio
[DockerHub]: https://hub.docker.com
[Flutter]: https://flutter.dev

[2]: https://github.com/cirruslabs/docker-images-android/pkgs/container/android-sdk

[80]: https://github.com/instrumentisto/flutter-docker-image/issues
[80]: https://github.com/opsdev-ws/flutter-docker-image/issues
[90]: https://github.com/instrumentisto/flutter-docker-image
[91]: https://github.com/instrumentisto/flutter-docker-image/blob/main/LICENSE.md
[92]: https://github.com/flutter/flutter/blob/master/LICENSE

[201]: https://github.com/instrumentisto/flutter-docker-image/blob/main/Dockerfile
[95]: https://github.com/instrumentisto
Loading