content: FROM ocaml/opam:debian-11-ocaml-4.14@sha256:18fcbeb356957c58cf8f37bc43adcca5683d50163a120d9b322b173428281e61 AS build
  RUN sudo apt-get update && sudo apt-get install libev-dev m4 pkg-config git -y --no-install-recommends
  RUN cd ~/opam-repository && git pull origin master && git reset --hard 15b381eeae1aa1c8b67b214ce1739344717aae89 && opam update
  COPY --chown=opam \
  	matrix-ci-server.opam \
  	matrix-common.opam \
  	matrix-ctos.opam \
  	matrix-stos.opam \
  	/src/
  
  WORKDIR /src
  RUN opam-2.1 install -y --deps-only .
  ADD --chown=opam . .
  RUN opam-2.1 exec -- dune subst
  RUN opam-2.1 exec -- dune build ./_build/install/default/bin/matrix-ci-server-setup ./_build/install/default/bin/matrix-ci-server-bin
  
  
  FROM debian:11
  RUN apt-get update && apt-get install libev4 openssh-client curl gnupg2 dumb-init git ca-certificates netbase -y --no-install-recommends
  RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
  RUN echo 'deb [arch=amd64] https://download.docker.com/linux/debian buster stable' >> /etc/apt/sources.list
  RUN apt-get update && apt-get install docker-ce -y --no-install-recommends
  
  WORKDIR /var/lib/matrix-server
  RUN git config --global user.email "matrix@localhost" && git config --global user.name "Matrix server" && git config --global init.defaultBranch main
  
  ENTRYPOINT ["dumb-init", "/usr/local/bin/docker_entry.sh"]
  ENV OCAMLRUNPARAM=a=2
  COPY --from=build /src/_build/install/default/bin/matrix-ci-server-setup /src/_build/install/default/bin/matrix-ci-server-bin /usr/local/bin/
  COPY docker_entry.sh /usr/local/bin/
  EXPOSE 8008
  EXPOSE 8448
  