FROM ocaml/opam:debian-ocaml-5.2 AS build # System dependencies RUN sudo apt-get update && sudo apt-get install -y \ autoconf \ pkg-config \ libgmp-dev \ libev-dev \ libffi-dev \ libssl-dev \ python3 \ jq \ && sudo rm -rf /var/lib/apt/lists/* # Set up oxcaml switch with the ox opam repo RUN opam update --all \ && opam switch create 5.2.0+ox \ --repos ox=git+https://github.com/oxcaml/opam-repository.git,alpha=git+https://github.com/kit-ty-kate/opam-alpha-repository.git,default \ && eval $(opam env --switch 5.2.0+ox) # Copy opam file first for dependency caching WORKDIR /home/opam/mono COPY --chown=opam:opam root.opam . RUN opam install --switch 5.2.0+ox --deps-only -y ./root.opam # Copy the full monorepo source COPY --chown=opam:opam . . # Build and install plugins, then build the site (without universes) RUN eval $(opam env --switch 5.2.0+ox) \ && dune build @install \ && dune install 2>/dev/null \ && dune build @site \ && dune build @doc # Assemble the site into _site/ RUN mkdir -p _site \ && cp -rf _build/default/site/_html/* _site/ \ && cp -rf _build/default/_doc/_html/reference/* _site/reference/ \ && mkdir -p _site/odoc.support/ \ && cp -rf _build/default/_doc/_html/odoc.support/* _site/odoc.support/ # Universe building (jtw is built from source in js_top_worker/) RUN eval $(opam env --switch 5.2.0+ox) \ && jtw opam astring base brr note mime_printer fpath rresult \ opam-format bos odoc.model tyxml yojson uri jsonm \ js_top_worker-widget-leaflet \ tessera-geotessera-jsoo tessera-viz-jsoo \ onnxrt -o _site/_opam # Deploy onnxrt assets RUN if [ -f onnxrt/example/sentiment/model_quantized.onnx ]; then \ cp onnxrt/example/sentiment/vocab.txt _site/_opam/vocab.txt \ && cp onnxrt/example/sentiment/model_quantized.onnx _site/_opam/model_quantized.onnx; \ fi \ && cp onnxrt/example/add.onnx _site/_opam/add.onnx # Lightweight final image with just the built site FROM nginx:alpine COPY --from=build /home/opam/mono/_site /usr/share/nginx/html EXPOSE 80