|
@@ -1,6 +1,6 @@
|
|
|
-FROM ocurrent/opam:fedora-32-ocaml-4.11
|
|
|
+FROM ocaml/opam:debian-10-ocaml-4.12
|
|
|
|
|
|
-ENV DIR webmachine
|
|
|
+ENV DIR project
|
|
|
# https://blog.packagecloud.io/eng/2017/02/21/set-environment-variable-save-thousands-of-system-calls/
|
|
|
ENV TZ :/etc/localtime
|
|
|
|
|
@@ -8,28 +8,52 @@ ENV TZ :/etc/localtime
|
|
|
# https://linux.die.net/man/1/ocamlrun
|
|
|
# https://blog.janestreet.com/memory-allocator-showdown/
|
|
|
ENV OCAMLRUNPARAM a=2,o=240
|
|
|
-# This makes the program only spawn one child process to serve requests
|
|
|
-ENV CORE_COUNT 1
|
|
|
|
|
|
-RUN sudo dnf install --assumeyes diffutils postgresql-devel libev-devel
|
|
|
+ENV PKGS="\
|
|
|
+atdgen>=2.2.1 \
|
|
|
+atdgen-runtime>=2.2.1 \
|
|
|
+caqti>=1.6.0 \
|
|
|
+caqti-driver-postgresql>=1.6.0 \
|
|
|
+caqti-lwt>=1.6.0 \
|
|
|
+cohttp-lwt-unix>=4.0.0 \
|
|
|
+conf-libev>=4-12 \
|
|
|
+dune>=2.8.5 \
|
|
|
+httpaf>=0.7.1 \
|
|
|
+httpaf-lwt-unix>=0.7.1 \
|
|
|
+lwt>=5.4.1 \
|
|
|
+lwt_ppx>=2.0.2 \
|
|
|
+opium>=0.20.0 \
|
|
|
+ppx_deriving_yojson>=3.6.1 \
|
|
|
+ppx_rapper>=3.0.0 \
|
|
|
+tiny_httpd>=0.8 \
|
|
|
+tyxml>=4.5.0 \
|
|
|
+webmachine>=0.7.0 \
|
|
|
+yojson>=1.7.0 \
|
|
|
+"
|
|
|
+
|
|
|
+RUN \
|
|
|
+ opam update && \
|
|
|
+ opam depext $PKGS && \
|
|
|
+ opam install $PKGS
|
|
|
|
|
|
WORKDIR /${DIR}
|
|
|
|
|
|
-COPY src/tfb.opam src/Makefile /${DIR}/
|
|
|
-COPY src/lib.opam src/Makefile /${DIR}/
|
|
|
-
|
|
|
-RUN make install
|
|
|
-
|
|
|
COPY ./src /${DIR}
|
|
|
|
|
|
RUN sudo chown -R opam: . && make build
|
|
|
|
|
|
+EXPOSE 8080
|
|
|
+
|
|
|
# try to keep everything above here in sync with other dockerfiles in project for more efficent use of docker build cache
|
|
|
-RUN sudo dnf install --assumeyes haproxy
|
|
|
+
|
|
|
+# This makes the program only spawn one child process to serve requests
|
|
|
+ENV APP_INSTANCES 1
|
|
|
+
|
|
|
+USER root
|
|
|
+
|
|
|
+RUN apt-get update && apt-get install -y haproxy
|
|
|
COPY haproxy.cfg /etc/haproxy/haproxy.cfg
|
|
|
COPY start-servers.sh ./start-servers.sh
|
|
|
-RUN sudo chown -R opam: . && chmod +x ./start-servers.sh
|
|
|
-
|
|
|
-EXPOSE 8080
|
|
|
+RUN chown -R opam: . && chmod +x ./start-servers.sh
|
|
|
|
|
|
-ENTRYPOINT ./start-servers.sh && sudo /usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid
|
|
|
+ENTRYPOINT ["/project/start-servers.sh", "_build/default/src/bin/tfb.exe"]
|