Closed bartekpacia closed 4 months ago
I wasn't able to find documentation that flutter precache
is called for the first flutter run
. I'm just worried that it will download too much rather than what's needed for a particular flutter run
.
@fkorotkov There's no docs around that, but it is true.
The possible inefficiency is that flutter precache
downloads artifacts for all platforms (ios, android, web + current desktop (macos or windows or linux)) and puts them in $FLUTTER_ROOT/bin/cache
:
But since this whole image is Ubuntu-based, I don't think efficiency is that important and that a few more executables (which they will download anyway) will matter to users. I, for once, would prefer an image that has all the stuff I will most likely need anyway, but which I end up doing at runtime every time.
But if you deem it important, then I think a "full" and "minimal" image could be provided?
I inspected the image using dive
and it adds about 0.5 GB:
Which platform are you developing from? flutter precache --help
suggests that we can disable some things. I wonder if flutter precache --no-ios --no-windows --no-macos
will bring the size down to something acceptable.
Here are some results:
REPOSITORY TAG IMAGE ID CREATED SIZE
flutter precache-android-linux-web 09060ea1f951 9 minutes ago 2.99GB
flutter precache-android-linux 04a912c9d16d 12 minutes ago 2.83GB
flutter precache-android 1724050f6c62 16 minutes ago 2.65GB
flutter precache-android-ios 847b9fbc2a96 11 hours ago 3.4GB
flutter precache 4dd426672dd7 12 hours ago 2.99GB
ghcr.io/cirruslabs/flutter 3.19.2 2c056fd12d90 6 days ago 2.46GB
I think it makes sense to just use flutter precache
. By default it downloads artifacts for all platforms that can be used on the machine (i.e it doesn't make sense to pass --ios
or --windows
since we can't build for them anyway on a Linux box).
So my suggestion is to have:
ghcr.io/cirruslabs/flutter:3.19.0
stays the sameghcr.io/cirruslabs/flutter:3.19.0-precached
is addedor the reverse. Names tentative - lite
, full
, mini
, whatever:)
What do you think @fkorotkov? I'm willing to contribute this.
What do you think of just precaching Android? Plus the size bump is not too big. Seems Android is the main use case for the images. Then if we'll have more requests than we can introduce variants.
I agree, let's do that.Good enough for now:)
flutter precache
is called anyway during the firstflutter run
anyway, which adds time (just now I checked with my very good connection andflutter precache
took additional 40s).So I think it makes sense to add it at build time.