feat(install): build the Flutter web app in Docker, optional ./install --apk, chosen web password, startup report
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
# Flutter build images for the Pipelines app. `web` builds the web client the
|
||||
# installer serves; `android` adds a JDK and the Android SDK for the optional
|
||||
# APK. The Flutter version is the app's own pin (app/.flutter-version).
|
||||
#
|
||||
# Built and run by scripts/app_build.py; the container runs as the invoking
|
||||
# user, so the SDK and cache directories are world-writable.
|
||||
FROM debian:bookworm-slim AS web
|
||||
ARG FLUTTER_VERSION
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates curl git unzip xz-utils zip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN test -n "$FLUTTER_VERSION" \
|
||||
&& git clone --depth 1 --branch "$FLUTTER_VERSION" https://github.com/flutter/flutter.git /opt/flutter \
|
||||
&& git config --system --add safe.directory '*'
|
||||
ENV PATH=/opt/flutter/bin:$PATH \
|
||||
HOME=/home/builder \
|
||||
PUB_CACHE=/home/builder/.pub-cache \
|
||||
FLUTTER_SUPPRESS_ANALYTICS=true
|
||||
RUN mkdir -p /home/builder/.pub-cache \
|
||||
&& flutter --disable-analytics && flutter config --no-cli-animations \
|
||||
&& flutter precache --web --no-android --no-ios --no-linux --no-macos --no-windows --no-fuchsia \
|
||||
&& chmod -R a+rwX /opt/flutter /home/builder
|
||||
COPY build.sh /usr/local/bin/pipelines-app-build
|
||||
WORKDIR /tmp
|
||||
|
||||
FROM web AS android
|
||||
ARG ANDROID_CMDLINE_TOOLS=13114758
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends openjdk-17-jdk-headless \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
ENV ANDROID_HOME=/opt/android-sdk \
|
||||
ANDROID_SDK_ROOT=/opt/android-sdk \
|
||||
GRADLE_USER_HOME=/home/builder/.gradle
|
||||
ENV PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$PATH
|
||||
RUN mkdir -p $ANDROID_HOME/cmdline-tools /home/builder/.gradle /home/builder/.android \
|
||||
&& curl -fsSL -o /tmp/tools.zip "https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_CMDLINE_TOOLS}_latest.zip" \
|
||||
&& unzip -q /tmp/tools.zip -d /tmp/tools && mv /tmp/tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest \
|
||||
&& rm -rf /tmp/tools /tmp/tools.zip \
|
||||
&& yes | sdkmanager --licenses >/dev/null \
|
||||
&& sdkmanager "platform-tools" >/dev/null \
|
||||
&& flutter config --android-sdk $ANDROID_HOME \
|
||||
&& flutter precache --android \
|
||||
&& chmod -R a+rwX /opt/android-sdk /opt/flutter /home/builder
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# Builds the app from the read-only source at /src into /out.
|
||||
# Usage: pipelines-app-build web|apk [flutter build arguments...]
|
||||
set -eu
|
||||
kind="$1"
|
||||
shift
|
||||
rm -rf /tmp/work && mkdir -p /tmp/work
|
||||
# A private copy: the host checkout's build outputs and machine paths stay out.
|
||||
(cd /src && tar --exclude=./build --exclude=./.dart_tool --exclude=./android/.gradle \
|
||||
--exclude=./android/local.properties --exclude=./android/app/.cxx --exclude=./ios/Pods \
|
||||
-cf - .) | tar -C /tmp/work -xf -
|
||||
cd /tmp/work
|
||||
flutter pub get
|
||||
case "$kind" in
|
||||
web)
|
||||
flutter build web --release --no-web-resources-cdn "$@"
|
||||
cp -R build/web/. /out/
|
||||
;;
|
||||
apk)
|
||||
flutter build apk --release "$@"
|
||||
cp build/app/outputs/flutter-apk/app-release.apk /out/pipelines.apk
|
||||
;;
|
||||
*)
|
||||
echo "unknown build: $kind" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user