forked from CatalaLang/catala
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (49 loc) · 2.06 KB
/
Dockerfile
File metadata and controls
62 lines (49 loc) · 2.06 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# This Dockerfile is only meant for the CI of the development of the
# Catala compiler itself. If you want a Docker image for the base
# of the CI of your Catala project, you should head over to
# https://gitlab.inria.fr/verifisc/docker-catala/container_registry/1606.
#
# STAGE 1: setup an opam switch with all dependencies installed
#
# (only depends on the opam files)
FROM ocamlpro/ocaml:4.14-2025-11-30 AS dev-build-context
# Image from https://hub.docker.com/r/ocamlpro/ocaml
RUN mkdir catala
WORKDIR catala
# Get only the opam files at this stage to allow caching
ADD --chown=ocaml:ocaml *.opam ./
# trigger the selection of catala dev tools in opam
ENV OPAMVAR_cataladevmode=1
# FIXME: openjdk's opam package should handle alpine os
RUN sudo apk add openjdk21 su-exec
# FIXME: pygments is in catala.opam's depexts but the depexts don't handle
# the --with-dev-setup option, hence theye're never installed by the command
# below...
RUN sudo apk add py3-pip py3-pygments groff bash
# Get a switch with all the dependencies installed
# DON'T run 'opam update' here. Instead use a newer parent Docker image
# (update the 'FROM' line above)
RUN opam --cli=2.2 switch create . --deps-only --with-test --with-doc --with-dev-setup && \
opam clean
#
# STAGE 2: get the whole repo and build
#
FROM dev-build-context
# Prepare extra local dependencies (doing this first allows caching)
ADD --chown=ocaml:ocaml runtimes/python/pyproject.toml runtimes/python/pyproject.toml
ADD --chown=ocaml:ocaml deps/dates-calc/lib_python/pyproject.toml deps/dates-calc/lib_python/pyproject.toml
ADD --chown=ocaml:ocaml Makefile .
ADD --chown=ocaml:ocaml syntax_highlighting syntax_highlighting
RUN opam exec -- make dependencies-python pygments
# Get the full repo
ADD --chown=ocaml:ocaml . .
# OCaml backtraces may be useful on failure
ENV OCAMLRUNPARAM=b
# Make sure warnings are treated as errors (variable used in Makefile, profile
# defined in ./dune)
ENV DUNE_PROFILE=check
ARG CATALA_VERSION
# Check the build
RUN opam exec -- make build
# Install to prefix
RUN opam exec -- make install-all && opam clean