[ANN] OCaml+opam Images for Docker for Windows
Hello all,
I’m glad to announce the availability of OCaml and opam native Windows Container images for Docker for Windows. This is the result of my hard work at Tarides, with precious help from @dra27, @talex5, @avsm, and the rest of the team.
They can be found under the ocaml/opam repository in the Docker Hub. Try them with Docker for Windows! Be sure to switch Docker to Native Windows Containers.
docker run -it ocaml/opam:windows-mingw
docker run -it ocaml/opam:windows-msvc
We provide images for the mingw-w64 (from OCaml 4.02 to 4.12) and the MSVC (from OCaml 4.06 to 4.12) ports. They are based on each release of Windows 10 amd64 currently supported by Microsoft on the Docker Hub. The images use opam 2.0, and we plan to update to opam 2.1 when it’s released. The images also ship a Cygwin installation, Git for Windows, and the winget package manager.
We use @fdopen’s OCaml for Windows distribution and opam-repository fork. As it is getting deprecated at the end of August 2021, we’ll transition to opam 2.1 and the standard opam-repository when that happens.
In order to get the correct environment for any RUN
command involving OCaml or opam, prefix the command with
-
ocaml-env exec --64 --
if based on mingw-w64; or -
ocaml-env exec --64 --ms=vs2019 --
if based on MSVC.
The images are built at https://base-images.ocamllabs.io/, using an OCurrent pipeline that builds Docker images. You can rebuild them yourself using the OCluster set of tools that I have ported to Windows.
We provide a comprehensive set of tags (replace port with either mingw or msvc):
-
windows-port
: the latest version of OCaml for each Windows version; -
windows-port-winver
: the latest version of OCaml for Windows 10 winver; -
windows-port-ocaml-mlver
: OCaml version mlver for each Windows version; -
windows-port-winver-ocaml-mlver
: OCaml version mlver for Window 10 winver.
When the Windows version is not specified in the tag, the image is a multiarch image that will work on every supported version of Windows 10. Docker automatically selects the appropriate one based on the host version.
We will be using these images in the upcoming ocaml-ci
and opam-repo-ci
for Windows.
Further work on these include the transition to opam 2.1, and we’ll provide the Cygwin port of OCaml when it’s fixed upstream and available in the Cygwin package repository.
Happy hacking!
– Antonin