44 lines
2.2 KiB
Docker
44 lines
2.2 KiB
Docker
# 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
|