Lightweight OCaml Docker Images created by dune with Multi-Stage Builds

I’ve written an article of Docker multi-stage Build for lightweight OCaml application using dune.
I refered this article(Lightweight OCaml Docker Images with Multi-Stage Builds) and customized to use dune.

Please feedbacks!

6 Likes

Nice write-up! You can also use opam lockfiles for reproducible builds: Lock file and dev dependencies with opam

The main difference in the Dockerfile will be:

opam install . --deps-only --locked

You won’t need to specify the packages in the install command, since they will be in the lockfile.

2 Likes

Thank you for your feedback!

I didn’t know opam-lock,
It’s sounds good!

I’ll learn about this tool and update the Dockerfile and articles.

1 Like