Skip to content

Commit

Permalink
Make use of the dartaotruntime to reduce container size
Browse files Browse the repository at this point in the history
By using the dart2aot compiler and using a multi-stage build, we can
reduce the resulting runtime to the dartaotruntime and the pre-built
aot binary - reducing the resulting container size by 1 order of
magnitude. This now resolves #1.
  • Loading branch information
pmundt committed Sep 27, 2019
1 parent 91e199a commit c5044a7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
FROM google/dart
FROM google/dart AS dart-runtime

WORKDIR /app

ADD pubspec.* /app/
RUN pub get
ADD . /app
ADD bin /app/bin/
ADD lib /app/lib/
RUN pub get --offline
RUN dart2aot /app/bin/server.dart /app/server.aot

FROM bitnami/minideb

COPY --from=dart-runtime /app/server.aot /server.aot
COPY --from=dart-runtime /usr/lib/dart/bin/dartaotruntime /dartaotruntime

CMD []
ENTRYPOINT ["/usr/bin/dart", "bin/server.dart"]
ENTRYPOINT ["/dartaotruntime", "/server.aot"]

EXPOSE 8080

0 comments on commit c5044a7

Please sign in to comment.