Use git clone for Flutter SDK to support arm64
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Linux desktop CI builds, Dockerfile.linux, linux) (release) Successful in 26m24s
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Android CI builds, Dockerfile.android, android) (release) Successful in 31m44s
Build and Push Flutter SDK Image / build-and-push (Minimal Flutter SDK for Web/WASM CI builds, Dockerfile, web) (release) Successful in 16m45s
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Linux desktop CI builds, Dockerfile.linux, linux) (release) Successful in 26m24s
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Android CI builds, Dockerfile.android, android) (release) Successful in 31m44s
Build and Push Flutter SDK Image / build-and-push (Minimal Flutter SDK for Web/WASM CI builds, Dockerfile, web) (release) Successful in 16m45s
Switch from downloading pre-built Flutter SDK tarballs to cloning from git. Flutter only provides x64 Linux tarballs, but cloning from git allows Flutter to bootstrap itself with the correct Dart SDK for any host architecture (amd64 or arm64). Also reduces image size from ~4GB to ~1.7GB for Android variant. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+4
-13
@@ -8,21 +8,12 @@ LABEL org.opencontainers.image.version="${FLUTTER_VERSION}"
|
||||
|
||||
USER 0
|
||||
|
||||
# Download Flutter SDK and strip unnecessary files in a single layer
|
||||
RUN curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" \
|
||||
-o /tmp/flutter.tar.xz && \
|
||||
tar xf /tmp/flutter.tar.xz -C /opt && \
|
||||
rm /tmp/flutter.tar.xz && \
|
||||
rm -rf /opt/flutter/dev \
|
||||
/opt/flutter/examples \
|
||||
/opt/flutter/bin/cache/artifacts/engine/android-* \
|
||||
/opt/flutter/bin/cache/artifacts/engine/linux-* && \
|
||||
# Clone Flutter SDK from git (supports both amd64 and arm64)
|
||||
RUN git clone --depth 1 --branch ${FLUTTER_VERSION} https://github.com/flutter/flutter.git /opt/flutter && \
|
||||
git config --global --add safe.directory /opt/flutter && \
|
||||
rm -rf /opt/flutter/dev /opt/flutter/examples && \
|
||||
chown -R 65532:65532 /opt/flutter
|
||||
|
||||
# Mark git directory as safe and compact git history
|
||||
RUN git config --global --add safe.directory /opt/flutter && \
|
||||
cd /opt/flutter && git gc --prune=all
|
||||
|
||||
USER 65532
|
||||
|
||||
# Configure for web-only (disable everything else)
|
||||
|
||||
Reference in New Issue
Block a user