Mono (F#) Docker image
This image is based on Alpine Linux image, which is only a 5MB image, and contains
Mono as well as the F# compiler and interpreter.
This image is sourced from the Mono docker image.
WARNING: That Mono image was compiled for Arch Linux and is ported to Alpine via
glibc hack! It is being used
because the current Mono package for Alpine Linux (based on musl instead of glibc)
generates a segfault when bootstrapping the F# compiler.
By default, the image will open the F# Interpreter and await input.
$ docker run -i -t neoeinstein/fsharp-alpine
You can also invoke the interpreter to execute a file:
$ echo 'let img = "Alpine Linux"' > qq.fsx $ echo 'printfn "Hello World from fsharpi on %s" img' >> qq.fsx $ docker run --rm -v "$(pwd)":/mnt neoeinstein/fsharp-alpine fsharpi --exec /mnt/qq.fsx
That same file can be compiled into an executable and run:
$ echo 'let img = "Alpine Linux" in printfn "Hello World from fsharpc on %s" img' > qq.fs $ docker run --rm -v "$(pwd)":/mnt neoeinstein/fsharp-alpine sh -c "fsharpc -o:/mnt/qq.exe /mnt/qq.fs && mono /mnt/qq.exe"