windows container for building flutter desktop apps
6.2K
These windows images are based upon ltsc2019 and have have all dependencies installed to build flutter desktop apps for windows.
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.
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
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.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\*
The Dockerfile to create the image has been inspired by the flutter-windows image created by Open Privacy.
Content type
Image
Digest
sha256:e21f1b161…
Size
8.8 GB
Last updated
about 1 year ago
docker pull tauu/flutter-windows-builder