Deployment and CI/CD

49.1 CLI and Server Deployment

Deploy to Cloud Run, Kubernetes, Fly.io, or AWS (ECS/Lambda custom runtime). Distribute CLIs via GitHub Releases (cross-platform builds in CI), Homebrew taps, or dart pub global activate.

# Dockerfile: AOT-compiled Dart server in a minimal image
FROM dart:stable AS build
WORKDIR /app
COPY pubspec.* ./
RUN dart pub get
COPY . .
RUN dart compile exe bin/server.dart -o bin/server

FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /app/bin/server /app/bin/
EXPOSE 8080
CMD ["/app/bin/server"]

49.2 CI Pipeline (GitHub Actions)

Flutter CI: subosito/flutter-action, flutter test, flutter build, signing via secrets. Distribute with Codemagic, Fastlane, Shorebird (code push), Firebase App Distribution, App Store Connect / Google Play.

Package publishing: automated publishing to pub.dev from GitHub Actions with OIDC (on tag push).

name: ci
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dart-lang/setup-dart@v1
        with:
          sdk: stable
      - run: dart pub get
      - run: dart format --output=none --set-exit-if-changed .
      - run: dart analyze --fatal-infos
      - run: dart test --coverage=coverage
      - run: dart compile exe bin/main.dart -o build/app