forked from ocaml/ocaml.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (28 loc) · 1.11 KB
/
Dockerfile
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
FROM ocaml/opam:alpine-3.13-ocaml-4.13 as build
# Install system dependencies
RUN sudo apk update && sudo apk add --update libev-dev openssl-dev gmp-dev nodejs npm
WORKDIR /home/opam
# Install Opam dependencies
ADD ocamlorg-data.opam ocamlorg-data.opam
ADD ocamlorg.opam ocamlorg.opam
RUN opam install . --deps-only
# Install NPM dependencies
ADD package.json package.json
ADD package-lock.json package-lock.json
RUN npm ci
# Build project
COPY --chown=opam:opam . .
RUN opam exec -- dune build @install @toplevel --profile=release --ignore-promoted-rules
FROM alpine:3.12 as run
RUN apk update && apk add --update libev gmp git
COPY --from=build /home/opam/_build/default/src/ocamlorg_web/bin/main.exe /bin/server
COPY --from=build /home/opam/_build/default/src/ocamlorg_toplevel/bin/js/ /var/toplevels/
ENV OCAMLORG_REPO_PATH /var/opam-repository/
ENV OCAMLORG_PKG_STATE_PATH /var/package.state
ENV OCAMLORG_TOPLEVELS_PATH /var/toplevels/
ENV OCAMLORG_DEBUG false
ENV DREAM_VERBOSITY info
RUN chmod -R 755 /var
RUN git clone https://github.com/ocaml/opam-repository /var/opam-repository
EXPOSE 8080
ENTRYPOINT /bin/server