|
|
@@ -0,0 +1,22 @@
|
|
|
+# Use latest stable channel SDK.
|
|
|
+FROM dart:stable AS build
|
|
|
+
|
|
|
+# Resolve app dependencies.
|
|
|
+WORKDIR /app
|
|
|
+COPY ./app/pubspec.* ./
|
|
|
+RUN dart pub get
|
|
|
+
|
|
|
+# Copy app source code (except anything in .dockerignore) and AOT compile app.
|
|
|
+COPY ./app .
|
|
|
+RUN dart pub get --offline
|
|
|
+RUN dart compile exe bin/main.dart -o bin/main --target-os linux
|
|
|
+
|
|
|
+# 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/main /app/bin/
|
|
|
+
|
|
|
+# Start server.
|
|
|
+EXPOSE 8080
|
|
|
+CMD ["/app/bin/main"]
|