All checks were successful
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Linux desktop CI builds, Dockerfile.linux, linux) (release) Successful in 1h8m47s
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Android CI builds, Dockerfile.android, android) (release) Successful in 1h11m0s
Build and Push Flutter SDK Image / build-and-push (Minimal Flutter SDK for Web/WASM CI builds, Dockerfile, web) (release) Successful in 6m49s
- Switch all Dockerfiles from debian:bookworm-slim to svrnty/base-distro:flutter-sdk-latest (Wolfi) - Use non-root user (UID 65532) instead of custom flutter user - Strip wrong-platform engine artifacts per variant (web, android, linux) - Remove dev/, examples/ and compact .git with git gc --prune=all - Android: multi-stage build for JDK 17 + Android SDK 36 from Debian - Linux: multi-stage build for clang/cmake/ninja/GTK3 with glibc conflict resolution - Update Android SDK from 35 to 36 (required by Flutter 3.38.9) Image sizes: web 1.32 GB, linux 2.43 GB, android 4.22 GB (down from 4.9 GB, 3.69 GB, 4.15 GB respectively) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
105 lines
4.0 KiB
Docker
105 lines
4.0 KiB
Docker
FROM svrnty/base-distro:flutter-sdk-latest AS base
|
|
|
|
ARG FLUTTER_VERSION=3.38.9
|
|
|
|
LABEL org.opencontainers.image.title="flutter-sdk-linux"
|
|
LABEL org.opencontainers.image.description="Flutter SDK for Linux desktop CI builds"
|
|
LABEL org.opencontainers.image.version="${FLUTTER_VERSION}"
|
|
|
|
# --- Install Linux desktop build deps in debian ---
|
|
FROM debian:bookworm-slim AS deps-stage
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
clang \
|
|
cmake \
|
|
ninja-build \
|
|
pkg-config \
|
|
libgtk-3-dev \
|
|
liblzma-dev \
|
|
libstdc++-12-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# --- Build final image ---
|
|
FROM base
|
|
|
|
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/flutter_web_sdk
|
|
|
|
RUN git config --global --add safe.directory /opt/flutter && \
|
|
cd /opt/flutter && git gc --prune=all
|
|
|
|
# Remove symlinks that conflict with COPY from debian stage
|
|
RUN rm -f /usr/lib/terminfo
|
|
|
|
# Copy only specific toolchain binaries (not all of /usr/bin which would overwrite Wolfi's core utils)
|
|
COPY --from=deps-stage /usr/bin/cmake /usr/bin/cmake
|
|
COPY --from=deps-stage /usr/bin/ninja /usr/bin/ninja
|
|
COPY --from=deps-stage /usr/bin/pkg-config /usr/bin/pkg-config
|
|
COPY --from=deps-stage /usr/bin/clang-14 /usr/bin/clang-14
|
|
RUN ln -sf clang-14 /usr/bin/clang && ln -sf clang-14 /usr/bin/clang++
|
|
|
|
# Copy libraries from debian stage (specific subdirectories to avoid overwriting Wolfi's core libs)
|
|
COPY --from=deps-stage /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
|
|
COPY --from=deps-stage /usr/lib/llvm-14 /usr/lib/llvm-14
|
|
COPY --from=deps-stage /usr/lib/cmake /usr/lib/cmake
|
|
COPY --from=deps-stage /usr/lib/gcc /usr/lib/gcc
|
|
COPY --from=deps-stage /usr/include /usr/include
|
|
COPY --from=deps-stage /usr/share/cmake-3.25 /usr/share/cmake-3.25
|
|
COPY --from=deps-stage /usr/share/pkgconfig /usr/share/pkgconfig
|
|
COPY --from=deps-stage /lib/x86_64-linux-gnu /lib/x86_64-linux-gnu
|
|
|
|
# Remove Debian's glibc/ld files that conflict with Wolfi's newer glibc,
|
|
# then register the Debian library paths and rebuild the linker cache
|
|
RUN rm -f /usr/lib/x86_64-linux-gnu/libc.so* /usr/lib/x86_64-linux-gnu/libm.so* \
|
|
/usr/lib/x86_64-linux-gnu/libpthread* /usr/lib/x86_64-linux-gnu/libdl.so* \
|
|
/usr/lib/x86_64-linux-gnu/librt.so* /usr/lib/x86_64-linux-gnu/libresolv* \
|
|
/usr/lib/x86_64-linux-gnu/libmvec* /usr/lib/x86_64-linux-gnu/libnss_* \
|
|
/usr/lib/x86_64-linux-gnu/ld-linux* /usr/lib/x86_64-linux-gnu/crt*.o \
|
|
/usr/lib/x86_64-linux-gnu/libpcre2-8.so* \
|
|
/lib/x86_64-linux-gnu/libc.so* /lib/x86_64-linux-gnu/libc-* \
|
|
/lib/x86_64-linux-gnu/libm.so* /lib/x86_64-linux-gnu/libm-* \
|
|
/lib/x86_64-linux-gnu/libpthread* /lib/x86_64-linux-gnu/libdl.so* \
|
|
/lib/x86_64-linux-gnu/librt.so* /lib/x86_64-linux-gnu/libresolv* \
|
|
/lib/x86_64-linux-gnu/libmvec* /lib/x86_64-linux-gnu/libnss_* \
|
|
/lib/x86_64-linux-gnu/ld-linux* \
|
|
/lib/x86_64-linux-gnu/libpcre2-8.so* && \
|
|
echo "/usr/lib/x86_64-linux-gnu" > /etc/ld.so.conf.d/debian-x86_64.conf && \
|
|
echo "/lib/x86_64-linux-gnu" >> /etc/ld.so.conf.d/debian-x86_64.conf && \
|
|
ldconfig
|
|
|
|
# Fix ownership before switching to flutter user
|
|
RUN chown -R 65532:65532 /opt/flutter
|
|
|
|
USER 65532
|
|
|
|
# Configure Flutter for Linux desktop only
|
|
RUN flutter config --enable-linux-desktop \
|
|
--no-enable-web \
|
|
--no-enable-android \
|
|
--no-enable-ios \
|
|
--no-enable-macos-desktop \
|
|
--no-enable-windows-desktop
|
|
|
|
# Precache only Linux artifacts
|
|
RUN flutter precache --linux \
|
|
--no-web \
|
|
--no-android \
|
|
--no-ios \
|
|
--no-macos \
|
|
--no-windows \
|
|
--no-fuchsia \
|
|
--no-universal
|
|
|
|
RUN flutter doctor -v
|
|
|
|
WORKDIR /app
|