Skip to content

PlugFox/docker_flutter

Repository files navigation

Flutter docker image

BUILD AND PUBLISH FLUTTER IMAGES GitHub Docker License: MIT

Docker Images for Flutter & Dart with useful utils and web build support. Symlinks to dart, flutter in the folder: /opt/flutter Release update strategy at every new flutter version.

Android tags include the Android SDK and Flutter for Android development. Web tags include the minify utility for web build optimization.

Environment variables

Base environment variables:

  • USER: flutter
  • WORKDIR: /home/flutter
  • SHELL: /bin/bash
  • FLUTTER_ROOT: /opt/flutter
  • FLUTTER_HOME: /opt/flutter
  • PUB_CACHE: /var/cache/pub

Andoid SDK environment variables:

  • ANDROID_HOME: /opt/android
  • ANDROID_SDK_ROOT: /opt/android
  • ANDROID_TOOLS_ROOT: /opt/android
  • ANDROID_SDK_TOOLS_VERSION: NNNNNNNN
  • ANDROID_PLATFORM_VERSION: XX
  • ANDROID_BUILD_TOOLS_VERSION: XX.0.0

How to build locally

docker build --compress \
    --file ./dockerfiles/flutter.dockerfile \
    --build-arg VERSION=stable \
    --tag plugfox/flutter:local .

docker build --compress \
    --file ./dockerfiles/flutter_web.dockerfile \
    --build-arg VERSION=local \
    --tag plugfox/flutter:local-web .

How to get shell

docker run --rm -it --name flutter_web \
    -w /app \
    plugfox/flutter:stable-web \
    /bin/bash

How to check image

docker run --rm -it --name flutter_web \
    -w /app \
    -v /tmp/build:/app/build/web \
    -v /tmp/cache:/var/cache/pub \
    plugfox/flutter:stable-web \
    /bin/bash -c "set -eux; flutter --version; dart --version; \
    flutter create --org="dev.flutter" --project-name="example" \
    --platforms=web --description="Example" . && \
    flutter pub get && flutter build web --release && \
    cd build/web && \
    mv index.html index.src.html && \
    minify --output index.html index.src.html"