docker_build.sh 780 Bytes
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1 2 3 4
#!/usr/bin/env bash
# Copyright 2014 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
5

6 7 8 9 10 11
# Capture the directory this script resides in
SCRIPT_DIRECTORY="$(dirname $(readlink -f "$0"))"

# Set context to flutter/dev
CONTEXT="${SCRIPT_DIRECTORY}/../.."

12 13
TAG="${CIRRUS_TAG:-latest}"

14 15 16 17
# Convert "+" to "-" to make hotfix tags legal Docker tag names.
# See https://docs.docker.com/engine/reference/commandline/tag/
TAG=${TAG/+/-}

18
# pull to make sure we are not rebuilding for nothing
19
sudo docker pull "gcr.io/flutter-cirrus/build-flutter-image:$TAG"
20

21 22 23 24
sudo docker build "$@" \
  --tag "gcr.io/flutter-cirrus/build-flutter-image:$TAG" \
  --file "$SCRIPT_DIRECTORY/Dockerfile" \
  "$CONTEXT"