-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzlscheck.docker
97 lines (81 loc) · 3.88 KB
/
zlscheck.docker
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# zlscheck over ocaml/opam2
#
# VERISON 0.1
# USAGE :
# build with `docker build -t zlscheck -f zlscheck.docker .` or with
# `make docker_build`
# run with `docker run -e DISPLAY=$DISPLAY -v $XAUTH:/root/.Xauthority -v /tmp/.X11-unix:/tmp/.X11-unix --rm --runtime=nvidia --rm -ti zlscheck bash`
# or `make docker_run`, once it has been built or loaded
# save with `docker save zlscheck > zlscheck.tar`, once it has been built
# load with `docker load --input zlscheck.tar`
#
# The source code will be under /home/zelus, /home/fadbadml and /home/zlscheck
# You can distribute the .tar file
FROM ocaml/opam2:4.10
LABEL description="This image contains `zlscheck`, a tool for testing Zélus \
programs. It also contains `FADBADml`, a library for automatic differentiation \
in OCaml and `zeluc`, a compiler from (Zélus)[http://zelus.di.ens.fr] to OCaml. \
It is built upon `ocaml/opam2` and it also provides the necessary libraries to \
compile the ml files that are produced by `zeluc`. It has been created to \
reproduce the results stated in ARCH 2020 friendly competition."
LABEL version="0.1"
LABEL maintainer="[email protected]"
# Install system dependencies
RUN sudo apt-get update \
&& sudo apt-get upgrade -y \
&& sudo apt-get install -y build-essential sudo m4 libgtk2.0-dev x11-apps
# Switch to root to give permissions to opam
USER root
# Give permission to opam to run `sudo`
RUN adduser opam sudo \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers # Don't ask for a password when running sudo
# Switch back to opam
USER opam
# Install OCaml dependencies
RUN eval $(opam env)
RUN opam config env >> /home/opam/.profile \
&& bash -c "source /home/opam/.profile" \
&& opam update \
&& opam upgrade \
&& opam install -y graphics ocamlfind menhir lablgtk ocamlfind
# Create directories
USER root
RUN mkdir -p /home/zelus && chown opam /home/zelus
RUN mkdir -p /home/fadbadml && chown opam /home/fadbadml
RUN mkdir -p /home/zlscheck && chown opam /home/zlscheck
RUN mkdir -p /home/zlscheck/arch/arch20 && chown opam /home/zlscheck/arch/arch20
RUN mkdir -p /home/zlscheck/arch/arch20/common && chown opam /home/zlscheck/arch/arch20/common
RUN mkdir -p /home/zlscheck/arch/arch20/matlab && chown opam /home/zlscheck/arch/arch20/matlab
RUN mkdir -p /home/zlscheck/arch/arch20/models && chown opam /home/zlscheck/arch/arch20/models
RUN mkdir -p /home/zlscheck/arch/arch20/shared && chown opam /home/zlscheck/arch/arch20/shared
# Copy zelus files in `workdir`
COPY --chown=opam external/zelus /home/zelus
COPY --chown=opam external/fadbadml /home/fadbadml
COPY --chown=opam src /home/zlscheck/src
COPY --chown=opam config.in configure Makefile README.md /home/zlscheck/
COPY --chown=opam arch/arch20/common/ /home/zlscheck/arch/arch20/common
COPY --chown=opam arch/arch20/matlab/ /home/zlscheck/arch/arch20/matlab
COPY --chown=opam arch/arch20/models/ /home/zlscheck/arch/arch20/models
COPY --chown=opam arch/arch20/shared/ /home/zlscheck/arch/arch20/shared
COPY --chown=opam arch/arch20/defbench.ml arch/arch20/Makefile \
arch/arch20/replay_bench.ml arch/arch20/run_bench.ml \
arch/arch20/read_results.ml /home/zlscheck/arch/arch20/
USER opam
# Compile `zeluc` and all the binary libs
WORKDIR /home/zelus
RUN opam config exec -- ./configure \
&& opam config exec -- make
# Compile `FADBADml` and all the binary libs
WORKDIR /home/fadbadml
RUN opam config exec -- ./configure \
&& opam config exec -- make
# Compile `zlscheck` and all the binary libs
WORKDIR /home/zlscheck
RUN opam config exec -- ./configure --external=../ \
&& opam config exec -- make
RUN cd arch/arch20 \
&& opam config exec make
# NOTE : To run Gtk apps inside docker, you should run the command
# `xhost +local:docker`
# in the host (your computer), then run the container with
# `docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix zelus bash`