Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 68b6e6ec54 | |||
| 553fee0a25 | |||
| b2e4c09c2b |
+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)
|
||||
|
||||
+10
-13
@@ -28,20 +28,17 @@ RUN mkdir -p "${ANDROID_HOME}/cmdline-tools" && \
|
||||
"platforms;android-${ANDROID_COMPILE_SDK}" \
|
||||
"build-tools;${ANDROID_BUILD_TOOLS}" && \
|
||||
# Remove lint-psi to eliminate protobuf-java 2.6.1 CVEs (saves 86MB)
|
||||
rm -rf "${ANDROID_HOME}/cmdline-tools/latest/lib/external/lint-psi"
|
||||
rm -rf "${ANDROID_HOME}/cmdline-tools/latest/lib/external/lint-psi" && \
|
||||
# Upgrade commons-lang3 from 3.16.0 to 3.18.0 to fix CVE-2025-48924
|
||||
rm -f "${ANDROID_HOME}/cmdline-tools/latest/lib/external/org/apache/commons/commons-lang3/3.16.0/commons-lang3-3.16.0.jar" && \
|
||||
mkdir -p "${ANDROID_HOME}/cmdline-tools/latest/lib/external/org/apache/commons/commons-lang3/3.18.0" && \
|
||||
curl -fsSL "https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.18.0/commons-lang3-3.18.0.jar" \
|
||||
-o "${ANDROID_HOME}/cmdline-tools/latest/lib/external/org/apache/commons/commons-lang3/3.18.0/commons-lang3-3.18.0.jar"
|
||||
|
||||
# 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
|
||||
# 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
|
||||
|
||||
# Fix ownership before switching to flutter user
|
||||
RUN chown -R 65532:65532 /opt/flutter "${ANDROID_HOME}"
|
||||
|
||||
+6
-11
@@ -8,18 +8,13 @@ LABEL org.opencontainers.image.version="${FLUTTER_VERSION}"
|
||||
|
||||
USER 0
|
||||
|
||||
# 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/android-* \
|
||||
/opt/flutter/bin/cache/flutter_web_sdk
|
||||
# Remove rav1e to eliminate CVE in paste crate (not needed for Flutter)
|
||||
RUN rm -f /usr/bin/rav1e /usr/lib/librav1e.so* /var/lib/db/sbom/rav1e-*.spdx.json
|
||||
|
||||
RUN git config --global --add safe.directory /opt/flutter && \
|
||||
cd /opt/flutter && git gc --prune=all
|
||||
# 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
|
||||
|
||||
# Fix ownership before switching to flutter user
|
||||
RUN chown -R 65532:65532 /opt/flutter
|
||||
|
||||
Reference in New Issue
Block a user