|
1 |
| -FROM alpine:3.11 AS builder |
2 |
| - |
3 |
| -RUN apk add --no-cache \ |
4 |
| - bash \ |
5 |
| - bubblewrap \ |
6 |
| - build-base \ |
7 |
| - ca-certificates \ |
8 |
| - coreutils \ |
9 |
| - curl \ |
10 |
| - git \ |
11 |
| - m4 \ |
12 |
| - ncurses-dev \ |
13 |
| - opam \ |
14 |
| - ocaml \ |
15 |
| - ocaml-compiler-libs \ |
16 |
| - patch \ |
17 |
| - rsync \ |
18 |
| - tar \ |
19 |
| - xz \ |
20 |
| - ; |
21 |
| - |
22 |
| -# Disable sandboxing |
23 |
| -RUN set -ex; \ |
24 |
| - echo 'wrap-build-commands: []' > ~/.opamrc; \ |
25 |
| - echo 'wrap-install-commands: []' >> ~/.opamrc; \ |
26 |
| - echo 'wrap-remove-commands: []' >> ~/.opamrc; \ |
27 |
| - echo 'required-tools: []' >> ~/.opamrc; |
| 1 | +FROM alpine:3.16 |
28 | 2 |
|
29 | 3 | ENV OPAMROOT=/opt/coq \
|
30 | 4 | OPAMYES=1 \
|
31 | 5 | OCAML_VERSION=default
|
32 |
| - |
33 |
| -RUN set -ex; \ |
34 |
| - mkdir -p /opt/coq; \ |
35 |
| - opam init --no-setup -j 4; \ |
36 |
| - opam repo add coq-released http://coq.inria.fr/opam/released; \ |
37 |
| - opam install -j 4 coq.8.12.0; \ |
38 |
| - opam pin add coq 8.12.0; \ |
39 |
| - opam install \ |
40 |
| - -j 4 \ |
41 |
| - coq-equations.1.2.3+8.12 \ |
42 |
| - coq-mathcomp-ssreflect.1.11.0 \ |
43 |
| - ; |
44 |
| - |
45 | 6 | ENV OPAM_SWITCH_PREFIX=/opt/coq/default
|
46 | 7 | ENV CAML_LD_LIBRARY_PATH=$OPAM_SWITCH_PREFIX/lib/stublibs:$OPAM_SWITCH_PREFIX/lib/ocaml/stublibs:$OPAM_SWITCH_PREFIX/lib/ocaml \
|
47 | 8 | OCAML_TOPLEVEL_PATH=$OPAM_SWITCH_PREFIX/lib/stublibs/lib/toplevel \
|
48 | 9 | PATH=$OPAM_SWITCH_PREFIX/bin:$PATH
|
| 10 | + |
49 | 11 | RUN set -ex; \
|
| 12 | + mkdir -p /opt/coq; \ |
| 13 | + # Work around https://github.com/ocaml/opam/issues/5186 by doing |
| 14 | + # `apk update` then cleaning up the cache in the same layer. |
| 15 | + apk update; \ |
| 16 | + apk add \ |
| 17 | + ocaml \ |
| 18 | + ; \ |
| 19 | + apk add --virtual .build-deps \ |
| 20 | + bash \ |
| 21 | + build-base \ |
| 22 | + bubblewrap \ |
| 23 | + ca-certificates \ |
| 24 | + curl \ |
| 25 | + git \ |
| 26 | + m4 \ |
| 27 | + ocaml-ocamldoc \ |
| 28 | + ocaml-compiler-libs \ |
| 29 | + opam \ |
| 30 | + tar \ |
| 31 | + ; \ |
| 32 | + opam init -y --disable-sandboxing; \ |
| 33 | + opam repo add coq-released http://coq.inria.fr/opam/released; \ |
| 34 | + opam install -j 4 \ |
| 35 | + # Let opam install system packages |
| 36 | + --confirm-level=unsafe-yes \ |
| 37 | + # Use the same versions as Coq Platform so users can easily get the same versions. |
| 38 | + # https://github.com/coq/platform/blob/main/package_picks/package-pick-8.15%7E2022.04.sh |
| 39 | + coq.8.15.2 \ |
| 40 | + coq-equations.1.3+8.15 \ |
| 41 | + coq-mathcomp-ssreflect.1.14.0 \ |
| 42 | + ; \ |
50 | 43 | cd /opt; \
|
51 |
| - git clone --depth 1 --branch v2.0.0 https://github.com/codewars/coq_codewars.git; \ |
| 44 | + mkdir /opt/coq_codewars; \ |
| 45 | + curl -sSL https://github.com/codewars/coq_codewars/archive/refs/tags/v2.0.0.tar.gz | tar xz -C /opt/coq_codewars --strip-components=1; \ |
52 | 46 | cd coq_codewars; \
|
53 | 47 | coq_makefile -f _CoqProject -o Makefile; \
|
54 |
| - make; |
55 |
| - |
56 |
| - |
57 |
| -FROM alpine:3.11 |
| 48 | + make; \ |
| 49 | + opam clean --repo-cache; \ |
| 50 | + apk del .build-deps; \ |
| 51 | + rm -rf /var/cache/apk/*; |
58 | 52 |
|
59 | 53 | RUN adduser -D codewarrior
|
60 |
| -RUN apk add --no-cache \ |
61 |
| - build-base \ |
62 |
| - ncurses-dev \ |
63 |
| - ocaml \ |
64 |
| - ; |
65 |
| -COPY --from=builder /opt/coq /opt/coq |
66 |
| -COPY --from=builder /opt/coq_codewars/src /opt/coq_codewars/src |
67 |
| -COPY --from=builder /opt/coq_codewars/theories/Loader.vo /opt/coq_codewars/theories/Loader.vo |
68 | 54 | RUN set -ex; \
|
69 | 55 | mkdir -p /workspace; \
|
70 |
| - chown codewarrior:codewarrior /workspace; |
| 56 | + chown -R codewarrior: /workspace; |
71 | 57 |
|
72 | 58 | USER codewarrior
|
73 |
| -ENV OPAM_SWITCH_PREFIX=/opt/coq/default |
74 |
| -ENV USER=codewarrior \ |
75 |
| - HOME=/home/codewarrior \ |
76 |
| - CAML_LD_LIBRARY_PATH=$OPAM_SWITCH_PREFIX/lib/stublibs:$OPAM_SWITCH_PREFIX/lib/ocaml/stublibs:$OPAM_SWITCH_PREFIX/lib/ocaml \ |
77 |
| - OCAML_TOPLEVEL_PATH=$OPAM_SWITCH_PREFIX/lib/stublibs/lib/toplevel \ |
78 |
| - PATH=$OPAM_SWITCH_PREFIX/bin:$PATH |
79 |
| - |
80 | 59 | WORKDIR /workspace
|
0 commit comments