1 # Flutter (https://flutter.dev) Development Environment for Linux 2 # =============================================================== 3 # 4 # This environment passes all Linux Flutter Doctor checks and is sufficient 5 # for building Android applications and running Flutter tests. 6 # 7 # To build iOS applications, a Mac development environment is necessary. 8 # 9 # This includes applications and sdks that are needed only by the CI system 10 # for performing pushes to production, and so this image is quite a bit larger 11 # than strictly needed for just building Flutter apps. 12 13 FROM debian:stretch 14 MAINTAINER Flutter Developers <flutter-dev@googlegroups.com> 15 16 RUN apt-get update -y 17 RUN apt-get upgrade -y 18 19 # Install basics 20 RUN apt-get install -y --no-install-recommends \ 21 git \ 22 wget \ 23 curl \ 24 zip \ 25 unzip \ 26 apt-transport-https \ 27 ca-certificates \ 28 gnupg 29 30 # Add repo for chrome stable 31 RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - 32 RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list 33 34 # Add repo for gcloud sdk and install it 35 RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \ 36 tee -a /etc/apt/sources.list.d/google-cloud-sdk.list 37 38 RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ 39 apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - 40 41 RUN apt-get update && apt-get install -y google-cloud-sdk && \ 42 gcloud config set core/disable_usage_reporting true && \ 43 gcloud config set component_manager/disable_update_check true 44 45 # Add nodejs repository to apt sources and install it. 46 ENV NODEJS_INSTALL="/opt/nodejs_install" 47 RUN mkdir -p "${NODEJS_INSTALL}" 48 RUN wget -q https://deb.nodesource.com/setup_10.x -O "${NODEJS_INSTALL}/nodejs_install.sh" 49 RUN bash "${NODEJS_INSTALL}/nodejs_install.sh" 50 51 # Install the rest of the dependencies. 52 RUN apt-get install -y --no-install-recommends \ 53 locales \ 54 golang \ 55 ruby \ 56 ruby-dev \ 57 nodejs \ 58 lib32stdc++6 \ 59 libstdc++6 \ 60 libglu1-mesa \ 61 build-essential \ 62 default-jdk-headless \ 63 google-chrome-stable 64 65 # Install the Android SDK Dependency. 66 ENV ANDROID_SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" 67 ENV ANDROID_TOOLS_ROOT="/opt/android_sdk" 68 RUN mkdir -p "${ANDROID_TOOLS_ROOT}" 69 RUN mkdir -p ~/.android 70 # Silence warning. 71 RUN touch ~/.android/repositories.cfg 72 ENV ANDROID_SDK_ARCHIVE="${ANDROID_TOOLS_ROOT}/archive" 73 RUN wget --progress=dot:giga "${ANDROID_SDK_URL}" -O "${ANDROID_SDK_ARCHIVE}" 74 RUN unzip -q -d "${ANDROID_TOOLS_ROOT}" "${ANDROID_SDK_ARCHIVE}" 75 # Suppressing output of sdkmanager to keep log size down 76 # (it prints install progress WAY too often). 77 RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "tools" > /dev/null 78 RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "build-tools;28.0.3" > /dev/null 79 RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platforms;android-28" > /dev/null 80 RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platform-tools" > /dev/null 81 RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "extras;android;m2repository" > /dev/null 82 RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "extras;google;m2repository" > /dev/null 83 RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "patcher;v4" > /dev/null 84 RUN rm "${ANDROID_SDK_ARCHIVE}" 85 ENV PATH="${ANDROID_TOOLS_ROOT}/tools:${PATH}" 86 ENV PATH="${ANDROID_TOOLS_ROOT}/tools/bin:${PATH}" 87 # Silence warnings when accepting android licenses. 88 RUN mkdir -p ~/.android 89 RUN touch ~/.android/repositories.cfg 90 91 # Setup gradle 92 ENV GRADLE_ROOT="/opt/gradle" 93 RUN mkdir -p "${GRADLE_ROOT}" 94 ENV GRADLE_ARCHIVE="${GRADLE_ROOT}/gradle.zip" 95 ENV GRADLE_URL="http://services.gradle.org/distributions/gradle-4.4-bin.zip" 96 RUN wget --progress=dot:giga "$GRADLE_URL" -O "${GRADLE_ARCHIVE}" 97 RUN unzip -q -d "${GRADLE_ROOT}" "${GRADLE_ARCHIVE}" 98 ENV PATH="$GRADLE_ROOT/bin:$PATH" 99 100 # Add npm to path. 101 ENV PATH="/usr/bin:${PATH}" 102 RUN dpkg-query -L nodejs 103 # Install Firebase 104 # This is why we need nodejs installed. 105 RUN /usr/bin/npm --verbose install -g firebase-tools 106 # TODO(dnfield): Remove this once Firebase has a fix upstream for 107 # https://github.com/flutter/flutter/issues/34435 108 COPY patch_firebase.sh /root/patch_firebase.sh 109 RUN /root/patch_firebase.sh 110 111 # Install dashing 112 # This is why we need golang installed. 113 RUN mkdir -p /opt/gopath/bin 114 ENV GOPATH=/opt/gopath 115 ENV PATH="${GOPATH}/bin:${PATH}" 116 RUN go get -u github.com/technosophos/dashing 117 118 # Set locale to en_US 119 RUN locale-gen en_US "en_US.UTF-8" && dpkg-reconfigure locales 120 ENV LANG en_US.UTF-8 121 122 # Install coveralls and Firebase 123 # This is why we need ruby installed. 124 # Skip all the documentation (-N) since it's just on CI. 125 RUN gem install coveralls -N 126 RUN gem install bundler -N 127 # Install fastlane which is used on Linux to build and deploy Android 128 # builds to the Play Store. 129 RUN gem install fastlane -N 130 131