Final updates
diff --git a/dart-services/Dockerfile b/dart-services/Dockerfile
index 46c3dff..938ba3e 100644
--- a/dart-services/Dockerfile
+++ b/dart-services/Dockerfile
@@ -1,6 +1,11 @@
# Keep aligned with min SDK in pubspec.yaml and Dart test version in .travis.yml
FROM google/dart:2.6.0
+# The specific commit that dart-services should use. This should be kept
+# in sync with the flutter submodule in the dart-services repo.
+# (run `git rev-parse HEAD` from the flutter submodule to retrieve this value.
+ARG FLUTTER_COMMIT=fbabb264e0ab3e090d6ec056e0744aaeb1586735
+
WORKDIR /app
ADD tool/dart_run.sh /dart_runtime/
@@ -10,9 +15,6 @@
ADD pubspec.* /app/
-RUN mkdir /app/third_party
-RUN mkdir /app/third_party/pkg
-
RUN find -name "*" -print
RUN pub get
@@ -25,35 +27,37 @@
# docker image diff small.
RUN apt-get update && \
apt-get install -y unzip && \
- cp -a third_party/pkg ../pkg && \
rm -rf /var/lib/apt/lists/*
-# The Flutter tool won't perform its actions unless run as root.
+# The Flutter tool won't perform its actions when run as root.
RUN groupadd --system dart && \
useradd --no-log-init --system --home /home/dart --create-home -g dart dart
RUN mkdir /flutter && chown dart:dart /flutter
+# Switch to a new, non-root user to use the flutter tool.
USER dart
ENV PATH="/home/dart/.pub-cache/bin:${PATH}"
+# Clone the flutter repo and set it to the same commit as the flutter submodule.
RUN cd / && git clone https://github.com/flutter/flutter.git
-RUN /flutter/bin/flutter channel dev
-RUN /flutter/bin/flutter upgrade
+RUN cd /flutter && git checkout $FLUTTER_COMMIT
+
+# Set the Flutter SDK up for web compilation.
+RUN /flutter/bin/flutter doctor
RUN /flutter/bin/flutter config --enable-web
RUN /flutter/bin/flutter precache --web --no-android --no-ios --no-linux \
--no-windows --no-macos --no-fuchsia
-RUN /flutter/bin/flutter doctor
RUN cat /flutter/bin/cache/dart-sdk/version
-
EXPOSE 8080 8181 5858
# Clear out any arguments the base images might have set and ensure we start
# the Dart app using custom script enabling debug modes.
CMD []
+# Switch back to root to run the application.
USER root
ENTRYPOINT /bin/bash /dart_runtime/dart_run.sh
diff --git a/dart-services/app.yaml b/dart-services/app.yaml
index cebcf6e..035b2cf 100644
--- a/dart-services/app.yaml
+++ b/dart-services/app.yaml
@@ -1,16 +1,12 @@
runtime: custom
env: flex
-# TODO(redbrogdon): remove this line when ready to merge.
-service: flutter-web-unforked
-
resources:
cpu: 1
memory_gb: 4
disk_size_gb: 50
automatic_scaling:
- # TODO(redbrogdon): set back to 6 before merging.
min_num_instances: 1
max_num_instances: 40
cool_down_period_sec: 60
diff --git a/dart-services/lib/src/common.dart b/dart-services/lib/src/common.dart
index 3ee7598..760abd2 100644
--- a/dart-services/lib/src/common.dart
+++ b/dart-services/lib/src/common.dart
@@ -44,7 +44,7 @@
}
""";
-const sampleCodeFlutter = """
+const sampleCodeFlutter = '''
import 'package:flutter/material.dart';
void main() async {
@@ -64,7 +64,7 @@
),
);
}
-""";
+''';
const sampleCodeMultiFoo = """
import 'bar.dart';
diff --git a/dart-services/lib/src/compiler.dart b/dart-services/lib/src/compiler.dart
index f6d5836..39ec29d 100644
--- a/dart-services/lib/src/compiler.dart
+++ b/dart-services/lib/src/compiler.dart
@@ -68,7 +68,7 @@
'--terse',
if (!returnSourceMap) '--no-source-maps',
'--packages=${_flutterWebManager.packagesFilePath}',
- '-o$kMainDart.js',
+ ...['-o', '$kMainDart.js'],
kMainDart,
];
@@ -111,7 +111,7 @@
}
}
- ///Compile the given string and return the resulting [DDCCompilationResults].
+ /// Compile the given string and return the resulting [DDCCompilationResults].
Future<DDCCompilationResults> compileDDC(String input) async {
Set<String> imports = getAllImportsFor(input);
if (!importsOkForCompile(imports)) {
diff --git a/dart-services/lib/src/sdk_manager.dart b/dart-services/lib/src/sdk_manager.dart
index 5d4c9da..bc2ffed 100644
--- a/dart-services/lib/src/sdk_manager.dart
+++ b/dart-services/lib/src/sdk_manager.dart
@@ -82,4 +82,4 @@
@override
String get versionFull => _versionFull;
-}
\ No newline at end of file
+}
diff --git a/dart-services/tool/grind.dart b/dart-services/tool/grind.dart
index 0c2d2c7..5e1a45a 100644
--- a/dart-services/tool/grind.dart
+++ b/dart-services/tool/grind.dart
@@ -34,7 +34,7 @@
@Task()
void serve() {
// You can run the `grind serve` command, or just run
- // `dart bin/server_dev.dart --port 8002` locally.
+ // `dart bin/server_dev.dart --port 8082` locally.
Process.runSync(
Platform.executable, ['bin/server_dev.dart', '--port', '8082']);
@@ -76,6 +76,24 @@
}
}
+@Task('validate that we have the correct commit SHA included in Dockerfile')
+void validateDockerfile() async {
+ final result = await Process.run('git', ['rev-parse', 'HEAD'],
+ workingDirectory: '../flutter');
+
+ final commitSha = result.stdout.toString();
+
+ final dockerfileContents = await File('Dockerfile').readAsString();
+
+ if (!dockerfileContents.contains(commitSha)) {
+ fail('The flutter submodule\'s current commit is $commitSha, '
+ 'and the Dockerfile doesn\'t include that string. Did you forget '
+ 'to update the Dockerfile after updating Flutter?');
+ } else {
+ print('Flutter commit $commitSha was found in Dockerfile.');
+ }
+}
+
Future _validateExists(String url) async {
log('checking $url...');
@@ -196,7 +214,7 @@
@Task('Update discovery files and run all checks prior to deployment')
@Depends(updateDockerVersion, discovery, analyze, test, fuzz,
- validateStorageArtifacts)
+ validateStorageArtifacts, validateDockerfile)
void deploy() {
log('Run: gcloud app deploy --project=dart-services --no-promote');
}
diff --git a/flutter b/flutter
index b0ad607..fbabb26 160000
--- a/flutter
+++ b/flutter
@@ -1 +1 @@
-Subproject commit b0ad6072efa07f1e497ba2e1ae94e3b87698f42f
+Subproject commit fbabb264e0ab3e090d6ec056e0744aaeb1586735