wasmtime: install a newer version of OCaml (#6205)

* wasmtime: install a newer version of OCaml

* Update Dockerfile

* wasmtime: move environment setup to build.sh
diff --git a/projects/wasmtime/Dockerfile b/projects/wasmtime/Dockerfile
index dc87834..ea72bfb 100644
--- a/projects/wasmtime/Dockerfile
+++ b/projects/wasmtime/Dockerfile
@@ -15,7 +15,13 @@
 ################################################################################
 
 FROM gcr.io/oss-fuzz-base/base-builder
-RUN apt-get update && apt-get install -y make autoconf automake libtool curl cmake python llvm-dev libclang-dev clang ocaml-nox
+RUN apt-get update && apt-get install -y make autoconf automake libtool curl cmake python llvm-dev libclang-dev clang
+
+# Install a newer version of OCaml than provided by Ubuntu 16.04 (base version for this image)
+RUN curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh -o install.sh && \
+  echo | sh install.sh && \
+  opam init --disable-sandboxing --yes && \
+  opam install ocamlbuild --yes
 
 RUN git clone --depth 1 https://github.com/bytecodealliance/wasm-tools wasm-tools
 
diff --git a/projects/wasmtime/build.sh b/projects/wasmtime/build.sh
index 80423e3..b22a11b 100755
--- a/projects/wasmtime/build.sh
+++ b/projects/wasmtime/build.sh
@@ -56,6 +56,9 @@
   done
 }
 
+# Ensure OCaml environment is set up prior to Wasmtime build.
+eval $(opam env)
+
 # Build with peepmatic in order to enable the related fuzz targets.
 build wasmtime "" "" --features "peepmatic-fuzzing experimental_x64"