- Update cmdline-tools from 11076708 to 14742923 (v20.0) - Update build-tools from 36.0.0 to 36.1.0 - Add Android SDK version checking to update-check workflow - Creates issues when Android SDK updates are available This reduces CVEs from 26 to 4 (all from protobuf-java 2.6.1 bundled by Google). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
73 lines
2.4 KiB
Docker
73 lines
2.4 KiB
Docker
FROM svrnty/base-distro:flutter-sdk-android-latest
|
|
|
|
ARG FLUTTER_VERSION=3.38.9
|
|
ARG ANDROID_SDK_TOOLS_VERSION=14742923
|
|
ARG ANDROID_COMPILE_SDK=36
|
|
ARG ANDROID_BUILD_TOOLS=36.1.0
|
|
|
|
LABEL org.opencontainers.image.title="flutter-sdk-android"
|
|
LABEL org.opencontainers.image.description="Flutter SDK for Android CI builds"
|
|
LABEL org.opencontainers.image.version="${FLUTTER_VERSION}"
|
|
|
|
USER 0
|
|
|
|
# Set up Android SDK environment
|
|
ENV ANDROID_HOME=/opt/android-sdk
|
|
ENV PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${PATH}"
|
|
|
|
# Download and install Android SDK command-line tools
|
|
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}"
|
|
|
|
# Download Flutter SDK and strip unnecessary files
|
|
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/linux-* \
|
|
/opt/flutter/bin/cache/flutter_web_sdk
|
|
|
|
RUN git config --global --add safe.directory /opt/flutter && \
|
|
cd /opt/flutter && git gc --prune=all
|
|
|
|
# Fix ownership before switching to flutter user
|
|
RUN chown -R 65532:65532 /opt/flutter "${ANDROID_HOME}"
|
|
|
|
USER 65532
|
|
|
|
# Configure Flutter 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
|