aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: e4b9ed26230c988be08ccb96ff2bb517f8933645 (plain)
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
FROM alpine:edge AS builder

# Install the build dependencies
RUN apk add --no-cache make m4 which patch sudo wget git pkgconfig \
	gcc g++ musl-dev linux-headers libffi libffi-dev pcre perl python3 \
	gmp-dev pcre-dev xz-dev gmp xz coreutils \
	ocaml ocaml-compiler-libs ocaml-ocamldoc opam ocaml-findlib openssh rsync
RUN chmod +s `which bwrap`

RUN addgroup -g 1000 -S ocaml && adduser -u 1000 -D -S ocaml -G ocaml
USER ocaml
WORKDIR /home/ocaml

RUN opam init --auto-setup --disable-sandboxing --yes -c 4.14.2 --keep-build-dir
RUN eval `opam env --switch=4.14.2`

RUN  opam install --yes dune && eval `opam env --switch=4.14.2`

COPY --chown=ocaml:ocaml stitch.opam /tmp/build/
WORKDIR /tmp/build
RUN git config --global --add safe.directory /tmp/build

RUN opam install . --update-invariant --yes
COPY . .
CMD eval `opam env` && dune build --profile release-static