From a92326374de9d3b0ae8c2ffa1f42c1eca96b76f7 Mon Sep 17 00:00:00 2001 From: Mathias Beaulieu-Duncan Date: Tue, 3 Feb 2026 03:53:29 -0500 Subject: [PATCH] Replace CLI examples with multi-stage Dockerfile examples - Web: Build app and serve with nginx - Android: Extract APK from multi-stage build - Linux: Build desktop app with minimal runtime - Consolidated CI/CD section Co-Authored-By: Claude Opus 4.5 --- README.md | 65 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 204d0eb..1690c4b 100644 --- a/README.md +++ b/README.md @@ -32,34 +32,51 @@ Lightweight Flutter SDK images for CI/CD pipelines. Built on [Wolfi](https://wol - **Non-root** - Runs as unprivileged user (UID 65532) - **Supply chain security** - SBOM and SLSA provenance attestations included -## Usage +## Dockerfile Examples -### Web +### Web App -```bash -docker run --rm -v $(pwd):/app -w /app svrnty/flutter-sdk:web-latest \ - flutter build web +```dockerfile +FROM svrnty/flutter-sdk:web-latest AS build +COPY . /app +WORKDIR /app +RUN flutter pub get && flutter build web --release + +FROM nginx:alpine +COPY --from=build /app/build/web /usr/share/nginx/html +EXPOSE 80 ``` -### Android +### Android APK -```bash -docker run --rm -v $(pwd):/app -w /app svrnty/flutter-sdk:android-latest \ - flutter build apk +```dockerfile +FROM svrnty/flutter-sdk:android-latest AS build +COPY . /app +WORKDIR /app +RUN flutter pub get && flutter build apk --release + +FROM scratch +COPY --from=build /app/build/app/outputs/flutter-apk/app-release.apk / ``` ### Linux Desktop -```bash -docker run --rm -v $(pwd):/app -w /app svrnty/flutter-sdk:linux-latest \ - flutter build linux +```dockerfile +FROM svrnty/flutter-sdk:linux-latest AS build +COPY . /app +WORKDIR /app +RUN flutter pub get && flutter build linux --release + +FROM ubuntu:22.04 +RUN apt-get update && apt-get install -y libgtk-3-0 && rm -rf /var/lib/apt/lists/* +COPY --from=build /app/build/linux/x64/release/bundle /app +ENTRYPOINT ["/app/my_app"] ``` -## CI/CD Examples - -### GitHub Actions +## CI/CD ```yaml +# GitHub Actions / Gitea Actions jobs: build: runs-on: ubuntu-latest @@ -67,31 +84,19 @@ jobs: image: svrnty/flutter-sdk:android-latest steps: - uses: actions/checkout@v4 + - run: flutter pub get - run: flutter build apk --release ``` -### GitLab CI - ```yaml +# GitLab CI build: image: svrnty/flutter-sdk:android-latest script: + - flutter pub get - flutter build apk --release ``` -### Gitea Actions - -```yaml -jobs: - build: - runs-on: ubuntu-latest - container: - image: svrnty/flutter-sdk:android-latest - steps: - - uses: actions/checkout@v3 - - run: flutter build apk --release -``` - ## Tags - `-latest` - Latest stable Flutter release