This repository contains template for an OCaml project using Dev Containers.
devcontainer.json uses a pre-built
Docker image based on ocaml/opam:ubuntu-24.04-ocaml-5.4 with the following
components available:
opam2.5.0ocaml5.4.1ocaml-lsp-serverocamlformatodocalcotestounit2qcheckbasecore
Image is iblazhko/ocaml-dev:5.4.1 and it is available from Docker Hub:
https://hub.docker.com/r/iblazhko/ocaml-dev.
docker pull iblazhko/ocaml-dev:5.4.1If you need to make any modifications to the development environment,
use included Dockerfile as a
starting point, modify the Dockefile to your liking, then build the image:
docker build -t '<tag>:<version>' .and update "image" value in the devcontainer.json to use the new image.
Alternatively, use "dockerFile" option instead of the "image"
in devcontainer.json, note however that image building may take a long time and this will affect startup time of devcontainer, so it is recommended to use a pre-built image.
To build multi-platform image, use following commands in .devcontainer:
Create multi-platform buildx container if you do not have one already:
docker buildx create --name multiplatform --bootstrap -platform linux/amd64,linux/arm64 --useInvoke multi-platform build and load resulting images into local Docker:
docker buildx build --platform linux/amd64,linux/arm64 --load --tag iblazhko/ocaml-dev:5.4.1 --tag iblazhko/ocaml-dev:5.4 --tag iblazhko/ocaml-dev:latest .Invoke multi-platform build and push resulting images to Docker Hub:
docker buildx build --platform linux/amd64,linux/arm64 --push --tag iblazhko/ocaml-dev:5.4.1 --tag iblazhko/ocaml-dev:5.4 --tag iblazhko/ocaml-dev:latest .