Skip to content

Instantly share code, notes, and snippets.

@lidemin
Created June 16, 2019 04:28
Show Gist options
  • Save lidemin/9740e27bdb4569b2a9047bbee68e316e to your computer and use it in GitHub Desktop.
Save lidemin/9740e27bdb4569b2a9047bbee68e316e to your computer and use it in GitHub Desktop.
# 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 <[email protected]>
# 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 -b stable 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 flutter upgrade
RUN flutter upgrade
# Perform a doctor run.
RUN flutter doctor -v
ENTRYPOINT [ "flutter" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment