2013: Create Dockerfile and build docker image
mkdir haskell-sb
cd haskell-sb
vim Dockerfile
or
git clone https://github.com/j4/dockerfiles.git
Create Dockerfile
Edit the file Dockerfile : vim Dockerfile
from j4pe/saucy
maintainer j4pe
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initctl
RUN echo "deb http://archive.ubuntu.com/ubuntu saucy main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN export DEBIAN_FRONTEND=noninteractive; apt-get install haskell-platform vim -y
RUN useradd ja -d /home/ja -s /bin/bash
Build docker image
Build haskell sandbox
cd haskell-sb
docker build -t j4pe/haskell-sb .
docker images
Run haskell sandbox, create haskell file (u+rx) in $HOME/bin/haskell
#!/bin/bash
docker run -u ja -h haskell -i -v=/home/ja:/home/ja -e=HOME=/home/ja -t j4pe/haskell-platform bash
and run sandbox !
2018: Haskell, Nix and Docker !
The example repository (GitHub)
├── ChangeLog.md
├── default.nix
├── docker.nix
├── LICENSE
├── Main.hs
├── sample-haskell-nix-docker.cabal
└── Setup.hs
default.nix
(import <nixpkgs> {}).haskellPackages.developPackage { root = ./.; }
docker.nix
with import <nixpkgs> {};
let
helloHaskell = import ./default.nix;
in {
helloHaskellAppImage = dockerTools.buildImage {
name = "hello-haskell";
contents = [
helloHaskell
];
config = {
Version = "1.0";
EntryPoint = ["sample-haskell-nix-docker"];
};
};
}
Use Docker and Nix
nix-build docker.nix -o hello-haskell.docker
cat hello-haskell.docker | docker load
docker run -it --rm hello-haskell:latest
Hello, Haskell!