From 6160a98cd8b2893054607ad685c72ae12ea8f4a5 Mon Sep 17 00:00:00 2001 From: Francois Date: Wed, 22 May 2024 11:38:53 +0200 Subject: [PATCH] Replace Flutter archive download with git clone of Flutter repo Use a build matching the current architecture rather than downloading a prebuilt archive --- .docker/android-apk-build.dockerfile | 20 ++++++++++---------- .docker/android-dev.dockerfile | 9 ++++----- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.docker/android-apk-build.dockerfile b/.docker/android-apk-build.dockerfile index abed4046..365490f6 100644 --- a/.docker/android-apk-build.dockerfile +++ b/.docker/android-apk-build.dockerfile @@ -1,4 +1,6 @@ -FROM --platform=linux/amd64 ubuntu:latest as build +FROM ubuntu:latest as build + +ENV FLUTTER_HOME "/home/komodo/.flutter-sdk" RUN apt update && \ apt upgrade -y && \ @@ -16,22 +18,20 @@ RUN curl -o assets/coins.json https://raw.githubusercontent.com/KomodoPlatform/c mkdir -p android/app/src/main/cpp/libs/arm64-v8a && \ python3 -m venv .venv && \ .venv/bin/pip install -r .docker/requirements.txt && \ - .venv/bin/python .docker/update_api.py --force + .venv/bin/python .docker/update_api.py --force && \ + git clone https://github.com/flutter/flutter.git ${FLUTTER_HOME} && \ + cd ${FLUTTER_HOME} && \ + git fetch && \ + git checkout tags/2.8.1 -FROM --platform=linux/amd64 ghcr.io/cirruslabs/android-sdk:34 as final +FROM ghcr.io/cirruslabs/android-sdk:34 as final ENV FLUTTER_VERSION="2.8.1" ENV FLUTTER_HOME "/home/komodo/.flutter-sdk" ENV USER="komodo" ENV PATH $PATH:$FLUTTER_HOME/bin -# Download and extract Flutter SDK -RUN mkdir -p $FLUTTER_HOME \ - && git config --global --add safe.directory /home/komodo/.flutter-sdk \ - && cd $FLUTTER_HOME \ - && curl --fail --remote-time --silent --location -O https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz \ - && tar xf flutter_linux_${FLUTTER_VERSION}-stable.tar.xz --strip-components=1 \ - && rm flutter_linux_${FLUTTER_VERSION}-stable.tar.xz +COPY --from=build --chown=$USER:$USER ${FLUTTER_HOME} ${FLUTTER_HOME} RUN flutter config --no-analytics \ && flutter precache \ diff --git a/.docker/android-dev.dockerfile b/.docker/android-dev.dockerfile index 50330b1e..66f2f282 100644 --- a/.docker/android-dev.dockerfile +++ b/.docker/android-dev.dockerfile @@ -19,11 +19,10 @@ USER $USER # Download and extract Flutter SDK RUN mkdir -p /home/komodo/workspace \ && chown -R $USER:$USER /home/komodo/workspace \ - && mkdir -p $FLUTTER_HOME \ - && cd $FLUTTER_HOME \ - && curl --fail --remote-time --silent --location -O https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz \ - && tar xf flutter_linux_${FLUTTER_VERSION}-stable.tar.xz --strip-components=1 \ - && rm flutter_linux_${FLUTTER_VERSION}-stable.tar.xz \ + && git clone https://github.com/flutter/flutter.git ${FLUTTER_HOME} \ + && cd ${FLUTTER_HOME} \ + && git fetch \ + && git checkout tags/2.8.1 \ && flutter config --no-analytics \ && flutter precache \ && yes "y" | flutter doctor --android-licenses \