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 <noreply@anthropic.com>
This commit is contained in:
Mathias Beaulieu-Duncan 2026-02-03 03:53:29 -05:00
parent eeaf0d00a5
commit a92326374d

View File

@ -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
- `<variant>-latest` - Latest stable Flutter release