-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
49 lines (46 loc) · 1.55 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
ARG HEMLOCK_PLATFORM=$BUILDPLATFORM
ARG HEMLOCK_UBUNTU_TAG=rolling
FROM --platform=${HEMLOCK_PLATFORM} ubuntu:${HEMLOCK_UBUNTU_TAG} AS base
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
ca-certificates \
git \
liburing-dev \
m4 \
opam \
sudo \
&& rm -rf /var/lib/apt/lists/* \
&& mv /home/ubuntu /home/hemlock \
&& groupmod -n hemlock ubuntu \
&& usermod -d /home/hemlock -c Hemlock -l hemlock ubuntu \
&& echo "hemlock ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
ARG HEMLOCK_BOOTSTRAP_OCAML_VERSION=4.14.0
USER hemlock
WORKDIR /home/hemlock
COPY --chown=hemlock:hemlock bootstrap/Hemlock.opam .
RUN opam init \
--bare \
--disable-sandboxing \
--dot-profile /home/hemlock/.bashrc \
--reinit \
--shell-setup \
--yes \
&& opam switch create ${HEMLOCK_BOOTSTRAP_OCAML_VERSION} \
&& opam install -y ocp-indent \
&& opam install -y --deps-only . \
&& rm Hemlock.opam
FROM --platform=${HEMLOCK_PLATFORM} base AS latest
USER hemlock
WORKDIR /home/hemlock/Hemlock
COPY --chown=hemlock:hemlock /.git/ .git
RUN git reset --hard
FROM --platform=${HEMLOCK_PLATFORM} latest AS test
USER hemlock
WORKDIR /home/hemlock/Hemlock/bootstrap
CMD find . -type f -regex '.*\mli?' \
| grep -v -e '^\./test/hocc/' -e '^\./bin/hocc/Parse\.ml$' \
| xargs -- opam exec -- ocp-indent -i \
&& git diff --exit-code \
&& opam exec -- dune build src \
&& opam exec -- dune runtest \
&& rm -rf _build