FROM debian:bookworm-slim ARG FLUTTER_VERSION=3.38.9 ARG ANDROID_SDK_TOOLS_VERSION=11076708 ARG ANDROID_COMPILE_SDK=35 ARG ANDROID_BUILD_TOOLS=35.0.1 LABEL org.opencontainers.image.title="gpb-flutter-sdk-android" LABEL org.opencontainers.image.description="Flutter SDK for Android CI builds" LABEL org.opencontainers.image.version="${FLUTTER_VERSION}" # Install dependencies for Flutter + Android SDK RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ git \ unzip \ xz-utils \ ca-certificates \ openjdk-17-jdk-headless \ && rm -rf /var/lib/apt/lists/* # Android SDK ENV ANDROID_HOME=/opt/android-sdk ENV PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${PATH}" RUN mkdir -p "${ANDROID_HOME}/cmdline-tools" && \ curl -fsSL "https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS_VERSION}_latest.zip" \ -o /tmp/cmdline-tools.zip && \ unzip -q /tmp/cmdline-tools.zip -d /tmp/cmdline-tools && \ mv /tmp/cmdline-tools/cmdline-tools "${ANDROID_HOME}/cmdline-tools/latest" && \ rm -rf /tmp/cmdline-tools.zip /tmp/cmdline-tools # Accept licenses and install SDK components RUN yes | sdkmanager --licenses > /dev/null 2>&1 && \ sdkmanager --install \ "platform-tools" \ "platforms;android-${ANDROID_COMPILE_SDK}" \ "build-tools;${ANDROID_BUILD_TOOLS}" # Flutter SDK ENV FLUTTER_HOME=/opt/flutter ENV PATH="${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin:${PATH}" 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 RUN git config --global --add safe.directory "${FLUTTER_HOME}" # Configure for Android-only RUN flutter config --enable-android \ --no-enable-web \ --no-enable-ios \ --no-enable-linux-desktop \ --no-enable-macos-desktop \ --no-enable-windows-desktop \ --android-sdk "${ANDROID_HOME}" # Precache only Android artifacts RUN flutter precache --android \ --no-web \ --no-ios \ --no-linux \ --no-macos \ --no-windows \ --no-fuchsia \ --no-universal RUN flutter doctor -v WORKDIR /app