Dockerfile 5.16 KB
Newer Older
Chris Bracken's avatar
Chris Bracken committed
1
# Flutter (https://flutter.dev) Development Environment for Linux
2 3 4 5 6 7 8 9 10 11 12
# ===============================================================
#
# 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.
#
# This includes applications and sdks that are needed only by the CI system
# for performing pushes to production, and so this image is quite a bit larger
# than strictly needed for just building Flutter apps.

13
# Last manual update 2021-09-24 (changing this comment will re-build image)
14

15
FROM debian:bullseye
16 17
MAINTAINER Flutter Developers <flutter-dev@googlegroups.com>

18 19
RUN apt-get update -y && \
  apt-get upgrade -y
20 21 22 23 24 25

# Install basics
RUN apt-get install -y --no-install-recommends \
  git \
  wget \
  curl \
26
  zip \
27
  unzip \
28
  apt-transport-https \
29 30 31
  ca-certificates \
  gnupg

32 33
# Add repo for chrome stable
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
34 35
RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | \
    tee /etc/apt/sources.list.d/google-chrome.list
36

37 38 39 40 41 42 43 44 45 46 47
# Add repo for gcloud sdk and install it
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \
    tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
    apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

RUN apt-get update && apt-get install -y google-cloud-sdk && \
    gcloud config set core/disable_usage_reporting true && \
    gcloud config set component_manager/disable_update_check true

48 49 50 51
# Add repo for OpenJDK 8 from JFrog.io
RUN wget -q -O - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add -
RUN echo 'deb [arch=amd64] https://adoptopenjdk.jfrog.io/adoptopenjdk/deb bullseye main' | \
    tee /etc/apt/sources.list.d/adoptopenjdk.list
52

53 54 55 56 57
# Install the dependencies needed for the rest of the build.
RUN apt-get update && apt-get install -y --no-install-recommends \
  adoptopenjdk-8-hotspot \
  build-essential \
  default-jdk-headless \
58
  gcc \
59
  google-chrome-stable \
60 61
  lib32stdc++6 \
  libglu1-mesa \
62 63 64 65 66 67 68 69 70
  libstdc++6 \
  locales \
  nodejs \
  npm \
  ruby \
  ruby-dev && \
  apt-get clean

ENV JAVA_HOME="/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64"
71 72 73 74 75 76 77 78 79 80 81 82 83 84

# 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}"
RUN mkdir -p ~/.android
# Silence warning.
RUN touch ~/.android/repositories.cfg
ENV ANDROID_SDK_ARCHIVE="${ANDROID_TOOLS_ROOT}/archive"
RUN wget --progress=dot:giga "${ANDROID_SDK_URL}" -O "${ANDROID_SDK_ARCHIVE}"
RUN unzip -q -d "${ANDROID_TOOLS_ROOT}" "${ANDROID_SDK_ARCHIVE}"
# Suppressing output of sdkmanager to keep log size down
# (it prints install progress WAY too often).
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "tools" > /dev/null
85
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "build-tools;28.0.3" > /dev/null
86
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platforms;android-30" > /dev/null
87
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platform-tools" > /dev/null
88
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "cmdline-tools;latest" > /dev/null
89 90 91 92 93 94 95 96 97 98 99 100 101 102
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "extras;android;m2repository" > /dev/null
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "extras;google;m2repository" > /dev/null
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "patcher;v4" > /dev/null
RUN rm "${ANDROID_SDK_ARCHIVE}"
ENV PATH="${ANDROID_TOOLS_ROOT}/tools:${PATH}"
ENV PATH="${ANDROID_TOOLS_ROOT}/tools/bin:${PATH}"
# Silence warnings when accepting android licenses.
RUN mkdir -p ~/.android
RUN touch ~/.android/repositories.cfg

# Add npm to path.
ENV PATH="/usr/bin:${PATH}"
RUN dpkg-query -L nodejs
# Install Firebase
103 104 105
# This is why we need nodejs installed.
RUN /usr/bin/npm --verbose install -g firebase-tools

106 107 108 109
# Install golang more recent than in repo (necessary for dashing to build)
RUN curl 'https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz' | tar xvz
ENV GOBINARY=/go/bin/go

110 111 112 113
# Install dashing
RUN mkdir -p /opt/gopath/bin
ENV GOPATH=/opt/gopath
ENV PATH="${GOPATH}/bin:${PATH}"
114
RUN $GOBINARY get -u github.com/technosophos/dashing
115 116

# Set locale to en_US
117
RUN locale-gen en_US "en_US.UTF-8" && DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
118 119
ENV LANG en_US.UTF-8

120
# Install fastlane via pinned Gemfile & Gemfile.lock
121 122
# Skip all the documentation (-N) since it's just on CI.
RUN gem install bundler -N
123

124
# Gemfile last edited 1/6/2019 (update to trigger a rebuild of Docker image)
125 126
COPY ci/docker_linux/Gemfile /Gemfile
COPY ci/docker_linux/Gemfile.lock /Gemfile.lock
127

128 129 130 131 132 133
# Install dependencies for desktop flutter run
RUN apt-get install -y --no-install-recommends \
  clang \
  cmake \
  libgtk-3-dev \
  ninja-build \
134 135 136 137
	pkg-config \
	x11-xserver-utils \
	xauth \
	xvfb && \
138 139 140
  apt-get upgrade -y --no-install-recommends && \
  apt-get clean

141 142
RUN bundle config set system 'true' && \
  bundle install --system