FROM svrnty/base-distro:flutter-sdk-latest ARG FLUTTER_VERSION=3.38.9 LABEL org.opencontainers.image.title="flutter-sdk-web" LABEL org.opencontainers.image.description="Minimal Flutter SDK for Web/WASM CI builds" 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-* && \ 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) RUN flutter config --enable-web \ --no-enable-android \ --no-enable-ios \ --no-enable-linux-desktop \ --no-enable-macos-desktop \ --no-enable-windows-desktop # Precache only web artifacts RUN flutter precache --web \ --no-android \ --no-ios \ --no-linux \ --no-macos \ --no-windows \ --no-fuchsia \ --no-universal # Verify installation RUN flutter doctor -v WORKDIR /app