2015-10-12

A Docker to try building F# for CoreCLR on Linux

I would really like to see F# work well on CoreCLR on Linux. I want to be able to build ASP.NET 5 and Suave apps on top. I started and published a Docker container at https://hub.docker.com/r/ctaggart/visualfsharp/. It extends the base image at https://hub.docker.com/r/microsoft/aspnet/. With it, you can try building F# for CoreCLR on Linux exactly like I have. I'm hoping we can more people working together on this using forks of this Docker container. Once we get the container setup, here is the start of the build output:

cd /opt/visualfsharp
msbuild src/fsharp-proto-build.proj /t:Rebuild /p:Configuration=Release
After you have setup Docker, you just have to run the container. The images for the container will be downloaded from the repository and a new bash shell will start.

docker run --rm -ti docker.io/ctaggart/visualfsharp
In the container shell, you can check the versions of the apps.

A Simple Docker Host


There are many options for setting up Docker. A simple, quick, and inexpensive way is to use Google Cloud. A standard virtual machine with a single virtual CPU (n1-standard-1) costs 5 cents per hour. You can put in a 10 hour day and only spend 50 cents. This entire setup should only take a few minutes. Start by going to https://console.developers.google.com/. Sign up if you don't have an account. They currently offer a 60-day trial. Select VM instances under Compute Engine, then click Create instance.

Name your new VM, and select Debian 8.1 Jessie.
When your virtual machine starts, click the SSH to popup a windows that allows you to SSH from your browser. This connectivity is a major time saver.
You are now connected remotely to your VM.
Now you just need to install docker on it following their instructions more concisely:
sudo apt-get install -y apt-transport-https
sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo debian-jessie main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y docker-engine
sudo service docker start
sudo gpasswd -a ${USER} docker
sudo service docker restart
exit

Reconnect to the VM and enjoy running docker.