|
1 | | -FROM buildpack-deps:bionic |
| 1 | +FROM ubuntu:22.04 AS Builder |
2 | 2 |
|
3 | | -RUN set -ex; \ |
4 | | - useradd --create-home codewarrior; \ |
5 | | -# TODO Remove symlink in the next version |
6 | | - ln -s /home/codewarrior /workspace; |
7 | | - |
8 | | -ENV OPAMROOT=/opt/opam \ |
9 | | - OPAMCOLOR=never |
| 3 | +ENV OPAMROOT=/opt/ocaml |
10 | 4 |
|
11 | 5 | RUN set -ex; \ |
12 | 6 | mkdir -p $OPAMROOT; \ |
| 7 | + useradd --create-home codewarrior; \ |
13 | 8 | chown codewarrior:codewarrior $OPAMROOT; \ |
14 | 9 | apt-get update; \ |
15 | 10 | apt-get install -y --no-install-recommends \ |
16 | 11 | software-properties-common \ |
17 | | - m4 \ |
18 | | - rsync \ |
19 | | - aspcud \ |
20 | | - ; \ |
21 | | -# Needed for opam 2.0 |
22 | | - add-apt-repository -y ppa:avsm/ppa; \ |
| 12 | + libgmp-dev \ |
| 13 | + opam \ |
| 14 | + ; |
| 15 | + |
| 16 | +USER codewarrior |
| 17 | +ENV USER=codewarrior |
| 18 | + |
| 19 | +RUN set -ex; \ |
| 20 | + opam init -y --shell-setup --disable-sandboxing --compiler=5.0.0; |
| 21 | + |
| 22 | +RUN set -ex; \ |
| 23 | + opam install -y \ |
| 24 | + 'batteries=3.6.0' \ |
| 25 | + 'base=v0.15.1' \ |
| 26 | + 'domainslib=0.5.0' \ |
| 27 | + 'ocamlbuild=0.14.2' \ |
| 28 | + 'ocamlfind=1.9.6' \ |
| 29 | + 'ounit2=2.2.7' \ |
| 30 | + 'zarith=1.12' \ |
| 31 | + ; |
| 32 | + |
| 33 | +FROM ubuntu:22.04 |
| 34 | + |
| 35 | +RUN set -ex; \ |
23 | 36 | apt-get update; \ |
24 | 37 | apt-get install -y --no-install-recommends \ |
25 | | - opam \ |
| 38 | + gcc \ |
| 39 | + libc6-dev \ |
| 40 | + libgmp-dev \ |
26 | 41 | ; \ |
27 | 42 | rm -rf /var/lib/apt/lists/*; |
28 | 43 |
|
29 | | -USER codewarrior |
30 | | -ENV USER=codewarrior \ |
31 | | - HOME=/home/codewarrior |
| 44 | +COPY --from=builder \ |
| 45 | + /opt/ocaml/5.0.0/bin/ocamlc.opt \ |
| 46 | + /opt/ocaml/5.0.0/bin/ocamlopt.opt \ |
| 47 | + /opt/ocaml/5.0.0/bin/ocamldep.opt \ |
| 48 | + /opt/ocaml/5.0.0/bin/ocamlbuild \ |
| 49 | + /opt/ocaml/5.0.0/bin/ocamlfind \ |
| 50 | + /opt/ocaml/5.0.0/bin/ |
| 51 | +COPY --from=builder \ |
| 52 | + /opt/ocaml/5.0.0/lib/ /opt/ocaml/5.0.0/lib/ |
32 | 53 |
|
33 | | -# --disable-sandboxing is needed to do this in a container witout `--privileged` |
34 | | -RUN opam init -y --compiler=4.07.1 --disable-sandboxing |
35 | | - |
36 | | -ENV OPAM_SWITCH_PREFIX=/opt/opam/4.07.1 \ |
37 | | - CAML_LD_LIBRARY_PATH=/opt/opam/4.07.1/lib/stublibs \ |
38 | | - OCAML_TOPLEVEL_PATH=/opt/opam/4.07.1/lib/toplevel \ |
39 | | - PATH=/opt/opam/4.07.1/bin:$PATH |
| 54 | +RUN set -ex; \ |
| 55 | + useradd --create-home codewarrior; \ |
| 56 | + mkdir -p /workspace; \ |
| 57 | + chown -R codewarrior:codewarrior /workspace; |
40 | 58 |
|
41 | | -RUN opam install -y \ |
42 | | - 'ounit=2.0.8' \ |
43 | | - 'batteries=2.9.0' \ |
44 | | - 'core=v0.11.3' \ |
45 | | - ; |
| 59 | +USER codewarrior |
| 60 | +ENV USER=codewarrior \ |
| 61 | + PATH=/opt/ocaml/5.0.0/bin:$PATH |
46 | 62 |
|
47 | | -COPY workspace/test.ml /workspace/test.ml |
48 | | -COPY workspace/_tags /workspace/_tags |
| 63 | +COPY --chown=codewarrior:codewarrior workspace/. /workspace/ |
| 64 | +WORKDIR /workspace |
0 commit comments