Skip to content

Instantly share code, notes, and snippets.

@chinmaygarde
Created July 2, 2018 18:09
Show Gist options
  • Save chinmaygarde/ee085d4ec1043e5cf99ae08f7cc27170 to your computer and use it in GitHub Desktop.
Save chinmaygarde/ee085d4ec1043e5cf99ae08f7cc27170 to your computer and use it in GitHub Desktop.
Flutter Android on Docker
# 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 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" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment