Skip to content

Instantly share code, notes, and snippets.

@chinmaygarde
Created July 2, 2018 18:09

Revisions

  1. chinmaygarde created this gist Jul 2, 2018.
    59 changes: 59 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    # Flutter (https://flutter.io) Developement Environment for Linux
    # ===============================================================
    #
    # This environment passes all Linux Flutter Doctor checks and is sufficient
    # for building Android applications and running Flutter tests.
    #
    # To build iOS applications, a Mac development environment is necessary.
    #

    FROM debian:stretch
    MAINTAINER Chinmay Garde <chinmaygarde@google.com>

    # Install Dependencies.
    RUN apt update -y
    RUN apt install -y \
    git \
    wget \
    curl \
    unzip \
    lib32stdc++6 \
    libglu1-mesa \
    default-jdk-headless

    # Install the Android SDK Dependency.
    ENV ANDROID_SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip"
    ENV ANDROID_TOOLS_ROOT="/opt/android_sdk"
    RUN mkdir -p "${ANDROID_TOOLS_ROOT}"
    ENV ANDROID_SDK_ARCHIVE="${ANDROID_TOOLS_ROOT}/archive"
    RUN wget -q "${ANDROID_SDK_URL}" -O "${ANDROID_SDK_ARCHIVE}"
    RUN unzip -q -d "${ANDROID_TOOLS_ROOT}" "${ANDROID_SDK_ARCHIVE}"
    RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "build-tools;28.0.0"
    RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platforms;android-28"
    RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platform-tools"
    RUN rm "${ANDROID_SDK_ARCHIVE}"
    ENV PATH="${ANDROID_TOOLS_ROOT}/tools:${PATH}"
    ENV PATH="${ANDROID_TOOLS_ROOT}/tools/bin:${PATH}"

    # Install Flutter.
    ENV FLUTTER_ROOT="/opt/flutter"
    RUN git clone https://github.com/flutter/flutter "${FLUTTER_ROOT}"
    ENV PATH="${FLUTTER_ROOT}/bin:${PATH}"
    ENV ANDROID_HOME="${ANDROID_TOOLS_ROOT}"

    # Disable analytics and crash reporting on the builder.
    RUN flutter config --no-analytics

    # Perform an artifact precache so that no extra assets need to be downloaded on demand.
    RUN flutter precache

    # Accept licenses.
    RUN yes "y" | flutter doctor --android-licenses

    # Perform a doctor run.
    RUN flutter doctor -v

    # Perform a flutter upgrade
    RUN flutter upgrade

    ENTRYPOINT [ "flutter" ]