Public Repository

Last pushed: 2 years ago
Short Description
LLVM-enabled Mono (F#) Docker image
Full Description

LLVM-enabled Mono (F#) Docker image

This image is based on the debian:jessie image and contains
the F# compiler and interpreter as well as Mono compiled with
LLVM integration enabled.

This image is sourced from the Mono docker image.
See the documentation for that image for important information on using the LLVM from Mono.

Total size of this image is only:


By default, the mono executable does not use the LLVM backend. You can enforce the use of LLVM
by using the --llvm argument when invoking mono or by setting the MONO_USE_LLVM environment
variable as in the below example.

If you would like to AOT-compile the Global Assembly Cache, execute /usr/local/bin/mono-gac-aot.
This script will use the LLVM backend and attempt to perform a full Ahead-Of-Time compilation of
mscorlib.dll and all assemblies in the GAC. This can take some time, and will likely compile
several assemblies that you may not need, though you can follow its pattern to execute a targeted
compilation of assemblies. The core F# libraries and executables have already been AOT-compiled
for your convenience.

Usage Example

By default, the image will open the F# Interpreter and await input.

$ docker run --rm -i -t -e MONO_USE_LLVM=1 neoeinstein/fsharp-llvm

You can also invoke the interpreter to execute a file:

$ echo 'let img = "LLVM"' > qq.fsx
$ echo 'printfn "Hello World from fsharpi with %s" img' >> qq.fsx
$ docker run --rm -e MONO_USE_LLVM=1 -v "$(pwd)":/mnt neoeinstein/fsharp-llvm fsharpi --exec /mnt/qq.fsx

That same file can be compiled into an executable and run:

$ echo 'let img = "LLVM" in printfn "Hello World from fsharpc with %s" img' > qq.fs
$ docker run --rm -e MONO_USE_LLVM=1 -v "$(pwd)":/mnt neoeinstein/fsharp-llvm sh -c "fsharpc -o:/mnt/qq.exe /mnt/qq.fs && mono /mnt/qq.exe"
Docker Pull Command

Comments (0)