Move docs and gallery deployment to Cirrus, add Docker image for Linux (#20097)
This adds a Docker image for the linux builds, replacing a lot of the setup code with a Docker build. Added a docker image build step that has the right gcloud credentials in it. Also, this finally moves the gallery deployment and docs publishing steps to Cirrus. They were dependent upon some environment setup that was a lot easier to do in Docker than in a setup bash script.
This commit is contained in:
93
dev/ci/docker_linux/Dockerfile
Normal file
93
dev/ci/docker_linux/Dockerfile
Normal file
@@ -0,0 +1,93 @@
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
|
||||
FROM debian:stretch
|
||||
MAINTAINER Flutter Developers <flutter-dev@googlegroups.com>
|
||||
|
||||
RUN apt-get update -y
|
||||
RUN apt-get upgrade -y
|
||||
|
||||
# Install basics
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
git \
|
||||
wget \
|
||||
curl \
|
||||
unzip \
|
||||
ca-certificates \
|
||||
gnupg
|
||||
|
||||
# Add nodejs repository to apt sources and install it.
|
||||
ENV NODEJS_INSTALL="/opt/nodejs_install"
|
||||
RUN mkdir -p "${NODEJS_INSTALL}"
|
||||
RUN wget -q https://deb.nodesource.com/setup_10.x -O "${NODEJS_INSTALL}/nodejs_install.sh"
|
||||
RUN bash "${NODEJS_INSTALL}/nodejs_install.sh"
|
||||
|
||||
# Install the rest of the dependencies.
|
||||
RUN apt-get install -y --no-install-recommends \
|
||||
locales \
|
||||
ruby \
|
||||
nodejs \
|
||||
lib32stdc++6 \
|
||||
libstdc++6 \
|
||||
libglu1-mesa \
|
||||
build-essential \
|
||||
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}"
|
||||
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
|
||||
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "build-tools;28.0.0" > /dev/null
|
||||
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platforms;android-28" > /dev/null
|
||||
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platform-tools" > /dev/null
|
||||
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
|
||||
|
||||
# Setup gradle
|
||||
ENV GRADLE_ROOT="/opt/gradle"
|
||||
RUN mkdir -p "${GRADLE_ROOT}"
|
||||
ENV GRADLE_ARCHIVE="${GRADLE_ROOT}/gradle.zip"
|
||||
ENV GRADLE_URL="http://services.gradle.org/distributions/gradle-4.4-bin.zip"
|
||||
RUN wget --progress=dot:giga "$GRADLE_URL" -O "${GRADLE_ARCHIVE}"
|
||||
RUN unzip -q -d "${GRADLE_ROOT}" "${GRADLE_ARCHIVE}"
|
||||
ENV PATH="$GRADLE_ROOT/bin:$PATH"
|
||||
|
||||
# Add npm to path.
|
||||
ENV PATH="/usr/bin:${PATH}"
|
||||
RUN dpkg-query -L nodejs
|
||||
# Install Firebase
|
||||
RUN /usr/bin/npm install -g firebase-tools
|
||||
|
||||
# Set locale to en_US
|
||||
RUN locale-gen en_US "en_US.UTF-8" && dpkg-reconfigure locales
|
||||
ENV LANG en_US.UTF-8
|
||||
|
||||
# Install coveralls and Firebase
|
||||
RUN gem install coveralls
|
||||
RUN gem install bundler
|
||||
|
||||
13
dev/ci/docker_linux/README.md
Normal file
13
dev/ci/docker_linux/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
This directory includes scripts to build the docker container image used for
|
||||
building flutter/flutter in our CI system (currently [Cirrus](cirrus-ci.org)).
|
||||
|
||||
In order to run the scripts, you have to setup `docker` and `gcloud`. Please
|
||||
refer to the [internal flutter team doc](go/flutter-team) for how to setup in a
|
||||
Google internal environment.
|
||||
|
||||
After setup,
|
||||
* edit `Dockerfile` to change how the container image is built.
|
||||
* run `./build_docker.sh` to build the container image.
|
||||
* run `./push_docker.sh` to push the image to google cloud registry. This will
|
||||
affect our CI tests.
|
||||
|
||||
8
dev/ci/docker_linux/docker_build.sh
Executable file
8
dev/ci/docker_linux/docker_build.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
TAG="${CIRRUS_TAG:-latest}"
|
||||
|
||||
# pull to make sure we are not rebuilding for nothing
|
||||
docker pull "gcr.io/flutter-cirrus/build-flutter-image:$TAG"
|
||||
|
||||
docker build --tag "gcr.io/flutter-cirrus/build-flutter-image:$TAG" .
|
||||
7
dev/ci/docker_linux/docker_login.sh
Executable file
7
dev/ci/docker_linux/docker_login.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -n "$CIRRUS_CI" && -n "$GCLOUD_CREDENTIALS" ]]; then
|
||||
echo "$GCLOUD_CREDENTIALS" | base64 --decode | docker login -u _json_key --password-stdin https://gcr.io
|
||||
else
|
||||
gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin https://gcr.io
|
||||
fi
|
||||
6
dev/ci/docker_linux/docker_push.sh
Executable file
6
dev/ci/docker_linux/docker_push.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
TAG="${CIRRUS_TAG:-latest}"
|
||||
|
||||
docker push "gcr.io/flutter-cirrus/build-flutter-image::$TAG"
|
||||
|
||||
Reference in New Issue
Block a user