Skip to content

Instantly share code, notes, and snippets.

@pmundt
Created October 4, 2019 08:07
Show Gist options
  • Save pmundt/90623593913822b81a70b87243438215 to your computer and use it in GitHub Desktop.
Save pmundt/90623593913822b81a70b87243438215 to your computer and use it in GitHub Desktop.
Multi-Stage Dockerfile for AOT compilation of server-side app
FROM google/dart AS dart-runtime
WORKDIR /app
ADD pubspec.* /app/
RUN pub get
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 ["/dartaotruntime", "/server.aot"]
EXPOSE 8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment