From d2ee7a320705089aae5860970ddbca62ead7867b Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Mon, 5 Jan 2026 03:29:09 -0800 Subject: [PATCH] [dartdev] Use `dart build cli` in `Dockerfile` template This updates the `Dockerfile` generated by `dart create` with the `server-shelf` template to use `dart build cli` instead of `dart compile exe`. The benefit of using the `build` command is that it runs hooks and bundles code assets. These assets should also be present in the container image. TEST=Tested manually (create template, build image, run) Change-Id: Ia8ccbba4ea6631ec6d5bb8866fd59ae4821375ba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470661 Reviewed-by: Daco Harkes Commit-Queue: Alexander Thomas Reviewed-by: Alexander Thomas --- pkg/dartdev/lib/src/templates/server_shelf.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/dartdev/lib/src/templates/server_shelf.dart b/pkg/dartdev/lib/src/templates/server_shelf.dart index 919858b93d0..016de74a194 100644 --- a/pkg/dartdev/lib/src/templates/server_shelf.dart +++ b/pkg/dartdev/lib/src/templates/server_shelf.dart @@ -157,13 +157,13 @@ RUN dart pub get # Copy app source code (except anything in .dockerignore) and AOT compile app. COPY . . -RUN dart compile exe bin/server.dart -o bin/server +RUN dart build cli --target bin/server.dart -o output # Build minimal serving image from AOT-compiled `/server` # and the pre-built AOT-runtime in the `/runtime/` directory of the base image. FROM scratch COPY --from=build /runtime/ / -COPY --from=build /app/bin/server /app/bin/ +COPY --from=build /app/output/bundle/ /app/ # Start server. EXPOSE 8080