blob: acf905d94cfe9003fdd46f7cae47b2e453be69f6 [file] [log] [blame]
# Official Dart image:
# Specify the Dart SDK base image version using dart:<version> (ex: dart:2.12)
FROM dart:stable AS build
# Resolve app dependencies.
COPY functions/pubspec.* functions/
WORKDIR /app/functions
RUN dart pub get
# Copy app source code and AOT compile it.
COPY functions/ .
# Ensure packages are still up-to-date if anything has changed
RUN dart pub get --offline
RUN dart compile exe bin/server.dart -o bin/server
# Build minimal serving image from AOT-compiled `/server` and required system
# libraries and configuration files stored in `/runtime/` from the build stage.
FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /app/functions/bin/server /app/bin/
# Start server.
CMD ["/app/bin/server"]