Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Dockerfile for working through Real World Ocaml https://github.com/realworldocaml/book
# See https://hub.docker.com/r/ocaml/opam/
FROM ocaml/opam
# Get core set up
RUN opam depext -i core
# Do some extra stuff to make cryptokit happy
RUN opam depext conf-zlib.1 && opam depext conf-gmp.1 && opam install cryptokit
# Install all the packages the book uses, including the utop REPL
RUN opam install utop async yojson core_extended core_bench cohttp async_graphics menhir
# Tell utop how to boot up with all the important functions you want
RUN echo '#use "topfind";; #thread;; #camlp4o;; #require "core.top";; #require "core.syntax";; open Core.Std' > ~/.ocamlinit
@joefraley

This comment has been minimized.

Copy link
Owner Author

joefraley commented May 7, 2017

To get started:

$ git clone https://gist.github.com/038fe86e9c5128386d4f144f1d31c7f3.git # this gist
# Builds on the https://hub.docker.com/r/ocaml/opam-dev/ commands
$ docker build -t ocaml-core .
$ docker run -ti ocaml-core bash

I also recommend mounting a local directory where you can write all your fancy new Ocaml in your preferred editor, but give Docker access to them to build and run:

$ mkdir ~/real-world-ocaml
# mounts your local machine directory to /real-world-ocaml in your container.
# See https://docs.docker.com/engine/tutorials/dockervolumes/#mount-a-host-directory-as-a-data-volume
$ docker run -ti ocaml-core bash -v ~/real-world-ocaml:/real-world-ocaml 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.