tauu/flutter-windows-builder

By tauu

Updated about 1 year ago

windows container for building flutter desktop apps

Image
Developer tools
0

6.2K

tauu/flutter-windows-builder repository overview

Windows image to build flutter desktop apps

These windows images are based upon ltsc2019 and have have all dependencies installed to build flutter desktop apps for windows.

Create build using docker run

The images have an entrypoint script, which creates a release build of a flutter app mounted at C:\src within a container. After building the app the result is copied to C:\src\build_container.

Example

Assuming the source of a flutter app is located at C:\myapp on your system, the following command will create a windows build of it and put the result into C:\myapp\build_container.

docker run --rm -v C:\myapp:C:\src tauu/flutter-windows-builder:latest
Parameters

The following options can be specified as command line options to docker run.

  • -example Build the example app of a package mounted at C:\src.
  • -msix Create a msix package after building the app. This requires that the msix package has been added as a dev dependency to the app.

CI/CD build

Gitlab

The image can be used in a Gitlab CI job description to build a flutter app and provide the result build as an artifact.

build-windows:
  stage: build
  image:
    name: tauu/flutter-windows-builder:latest
    entrypoint: ["C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"]
  script:
    # Move the whole source directory to C:\mysrc, as it is not possible to build
    # the project in its default location. The default location is within an alias mount.
    # Within this mount it is not possible to create a symlink to a file / directory
    # outside of it. When downloading packages, flutter tries to create symlinks
    # in windows\flutter\ephemeral\.plugin_symlinks, which point to the plugin
    # directory in the local pub cache. The cache resides in the flutter
    # installation and is not part of the filesystem exposed by the alias mount.
    # Consequently creating the link will fail and the build exits with an error.
    # Building in C:\src does also not work, as this directory is marked
    # as a volume in the dockerfile.
    - New-Item -Path "C:\" -Name "mysrc" -ItemType "directory"
    - Copy-Item -Path ".\*" -Destination "C:\mysrc\" -Recurse
    - cd C:\mysrc\
    - flutter clean
    - flutter build windows --release
    # Copy output back to the original build directory,
    # as gitlab-runner searches for it in this location.
    - cd -
    - Copy-Item -Path "C:\mysrc\build" -Destination "." -Recurse
  artifacts:
    paths:
      - build\windows\runner\Release\*

Acknowledgements

The Dockerfile to create the image has been inspired by the flutter-windows image created by Open Privacy.

Tag summary

Content type

Image

Digest

sha256:e21f1b161

Size

8.8 GB

Last updated

about 1 year ago

docker pull tauu/flutter-windows-builder