Dockerfile 607 B

12345678910111213141516171819202122
  1. # Use latest stable channel SDK.
  2. FROM dart:stable AS build
  3. # Resolve app dependencies.
  4. WORKDIR /app
  5. COPY ./app/pubspec.* ./
  6. RUN dart pub get
  7. # Copy app source code (except anything in .dockerignore) and AOT compile app.
  8. COPY ./app .
  9. RUN dart pub get --offline
  10. RUN dart compile exe bin/main.dart -o bin/main --target-os linux
  11. # Build minimal serving image from AOT-compiled `/server`
  12. # and the pre-built AOT-runtime in the `/runtime/` directory of the base image.
  13. # FROM scratch
  14. # COPY --from=build /runtime/ /
  15. # COPY --from=build /app/bin/main /app/bin/
  16. # Start server.
  17. EXPOSE 8080
  18. CMD ["/app/bin/main"]