Dockerfile - Typed Dockerfiles for OCaml: eDSL, printer and parser #
Warning. This is a work-in-progress experimental fork of ocaml-dockerfile. Do not use it in production; use ocaml-dockerfile instead.
A typed representation of a Dockerfile: an embedded DSL for writing one,
a printer (Dockerfile.to_string) and a parser (Dockerfile.of_string). The
opam package is nox-dockerfile, since the bare dockerfile name belongs to
upstream, and it exposes the Dockerfile module.
Generating Dockerfiles from string templates makes it easy to emit one that
Docker rejects or reads differently. With this library the caller builds a
Dockerfile.t from combinators and prints it. The parser, written with
ocamllex and menhir, reads a Dockerfile back into the same type and
round-trips with Dockerfile.to_string over the instructions the DSL covers,
so a container builder can take a Dockerfile as its input format.
Dockerfile.instructions gives a flat, typed view of the parsed instructions,
and Dockerfile.Cursor edits them in place, for example to swap a base image.
The code comes from Anil Madhavapeddy's ocaml-dockerfile. This fork drops
the ppx_sexp_conv and sexplib dependency, and with it the
[@@deriving sexp] serialisation, so the library needs only fmt and
nox-loc.
Installation #
Install with opam:
$ opam install nox-dockerfile
If opam cannot find the package, it may not yet be released in the public
opam-repository. Add the overlay repository, then install it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install nox-dockerfile
Credits and license #
ISC, Copyright (c) 2016 Anil Madhavapeddy and the ocaml-dockerfile contributors. See LICENSE.md.
- OCaml 100%