This repository was archived by the owner on Aug 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (42 loc) · 2.12 KB
/
Dockerfile
File metadata and controls
46 lines (42 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Build the ReasonReact app in a Node container
FROM node:10.16.3 AS js-builder
WORKDIR /home/sihl/app
COPY package.json yarn.lock bsconfig.json ./
COPY src src
COPY static static
RUN yarn
RUN yarn build
# Build the Sihl backend in a OPAM/OCaml container
FROM ocaml/opam2:4.08 AS ocaml-builder
WORKDIR app
COPY sihl_example_issues.opam .
COPY dune-project .
RUN opam pin add -yn sihl https://github.com/oxidizing/sihl.git\#0.0.31 && \
opam pin add -yn sihl_postgresql https://github.com/oxidizing/sihl.git\#0.0.31 && \
opam pin add -yn sihl_admin https://github.com/oxidizing/sihl.git\#0.0.31 && \
opam pin add -yn sihl_session https://github.com/oxidizing/sihl.git\#0.0.31 && \
opam pin add -yn sihl_session_postgresql https://github.com/oxidizing/sihl.git\#0.0.31 && \
opam pin add -yn sihl_email https://github.com/oxidizing/sihl.git\#0.0.31 && \
opam pin add -yn sihl_email_postgresql https://github.com/oxidizing/sihl.git\#0.0.31 && \
opam pin add -yn sihl_user https://github.com/oxidizing/sihl.git\#0.0.31 && \
opam pin add -yn sihl_user_postgresql https://github.com/oxidizing/sihl.git\#0.0.31 && \
opam pin add -yn sihl_example_issues . && \
opam depext -y sihl_example_issues && \
opam install --deps-only sihl_example_issues
COPY Makefile .
COPY src src
RUN sudo chown -R opam:nogroup . && \
opam config exec -- make
# Copy over the binaries from stage 1 and 2 and install systems dependencies
FROM debian:10-slim
WORKDIR /app
# TODO use output of previous opam depext to automatically fetch correct system deps
RUN apt-get update -y && \
apt-get install -qq -yy emacs-nox libffi-dev libgmp-dev libpcre3-dev libpq-dev libssl-dev m4 perl pkg-config
# WTF: https://github.com/mirage/ocaml-cohttp/issues/675
RUN echo "http 80/tcp www # WorldWideWeb HTTP" >> /etc/services
RUN echo "https 443/tcp www # WorldWideWeb HTTPS" >> /etc/services
COPY --from=ocaml-builder /home/opam/opam-repository/app/_build/default/src/bin/Run.exe run.exe
COPY --from=js-builder /home/sihl/app/dist static
ENV SIHL_ENV production
CMD ["/app/run.exe", "start"]