-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
104 lines (89 loc) · 3.22 KB
/
Dockerfile
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
98
99
100
101
102
103
104
FROM debian:11-slim
ARG OPAM_VERSION
ENV OPAM_VERSION=${OPAM_VERSION}
SHELL ["/bin/bash", "--login", "-o", "pipefail", "-c"]
# hadolint ignore=DL3008
RUN cat /proc/cpuinfo /proc/meminfo \
&& [ -n "${OPAM_VERSION}" ] \
&& apt-get update -y -q \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends \
autoconf \
automake \
bubblewrap \
build-essential \
ca-certificates \
curl \
git \
# gnupg is temporarily installed and will not be kept in the image
gnupg \
less \
libgmp-dev \
m4 \
openssh-client \
pkg-config \
rlwrap \
rsync \
sudo \
time \
unzip \
&& binary="opam-${OPAM_VERSION}-$(uname -m)-$(uname -s | tr '[:upper:]' '[:lower:]')" \
&& set -x \
&& curl -fSL -o "/tmp/${binary}" "https://github.com/ocaml/opam/releases/download/${OPAM_VERSION}/${binary}" \
&& curl -fSL -o "/tmp/${binary}.sig" "https://github.com/ocaml/opam/releases/download/${OPAM_VERSION}/${binary}.sig" \
&& curl -fsSL https://opam.ocaml.org/opam-dev-pubkey.pgp | gpg --batch --import \
&& gpg --batch --verify "/tmp/${binary}.sig" "/tmp/${binary}" \
&& mv "/tmp/${binary}" /usr/local/bin/opam \
&& chmod a+x /usr/local/bin/opam \
&& rm -f "/tmp/${binary}.sig" \
&& rm -fr /root/.gnupg \
&& DEBIAN_FRONTEND=noninteractive apt-get purge -y -q --auto-remove gnupg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Use Docker build args to set the UID/GID
ARG guest_uid=1000
ARG guest_gid=${guest_uid}
# Add Coq group and user with sudo perms
RUN groupadd -g ${guest_gid} coq \
&& useradd --no-log-init -m -s /bin/bash -g coq -G sudo -p '' -u ${guest_uid} coq \
# Create dirs for user scripts
&& mkdir -p -v /home/coq/bin /home/coq/.local/bin \
&& chown coq:coq /home/coq/bin /home/coq/.local /home/coq/.local/bin
# Load travis.sh at login
COPY travis.sh /etc/profile.d/
WORKDIR /home/coq
USER coq
ENV NJOBS="2"
ENV OPAMPRECISETRACKING="1"
ARG COMPILER
ENV COMPILER=${COMPILER}
# The following variable is unneeded for ocaml < 4.12
# Otherwise, use e.g.:
# --build-arg=COMPILER=4.12.0+flambda
# --build-arg=COMPILER_PACKAGE=ocaml-variants.4.12.0+options,ocaml-option-flambda
ARG COMPILER_PACKAGE
ARG OCAMLFIND_VERSION
ENV OCAMLFIND_VERSION=${OCAMLFIND_VERSION}
ARG DUNE_VERSION
ENV DUNE_VERSION=${DUNE_VERSION}
ARG NUM_VERSION=0
# or 1.4
ARG ZARITH_VERSION
ENV ZARITH_VERSION=${ZARITH_VERSION}
# hadolint ignore=SC2046
RUN set -x \
&& opam init --auto-setup --yes --bare --disable-sandboxing \
&& opam switch create --jobs=${NJOBS} ${COMPILER} ${COMPILER_PACKAGE:+--package=}${COMPILER_PACKAGE} \
&& eval $(opam env) \
&& opam repository add --all-switches --set-default coq-released https://coq.inria.fr/opam/released \
&& opam update -y \
&& opam install -y -j 1 opam-depext \
&& opam pin add -n -k version ocamlfind ${OCAMLFIND_VERSION} \
&& opam pin add -n -k version dune ${DUNE_VERSION} \
&& opam pin add -n -k version num ${NUM_VERSION} \
&& opam pin add -n -k version zarith ${ZARITH_VERSION} \
&& opam install -y -v -j ${NJOBS} ocamlfind dune num zarith \
&& opam clean -a -c -s --logs \
&& opam config list && opam list
ENTRYPOINT ["opam", "exec", "--"]
CMD ["/bin/bash", "--login"]
LABEL maintainer="erik@martin-dorel.org"