2022-08-13 14:36:50 +03:00
|
|
|
FROM ubuntu:22.04 AS build
|
2020-07-14 20:58:38 +03:00
|
|
|
|
2024-05-20 17:04:46 +03:00
|
|
|
ARG GHCVER="9.4.8"
|
|
|
|
ARG CABALVER="3.10.3.0"
|
2022-08-13 14:36:50 +03:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y \
|
|
|
|
# ghcup requirements
|
|
|
|
build-essential curl libffi-dev libffi8 libgmp-dev libgmp10 libncurses-dev libncurses6 libtinfo6 \
|
|
|
|
# Cryptol dependencies
|
|
|
|
zlib1g-dev \
|
|
|
|
# Miscellaneous
|
|
|
|
unzip
|
2020-07-28 18:41:27 +03:00
|
|
|
RUN useradd -m cryptol
|
2020-07-14 20:58:38 +03:00
|
|
|
COPY --chown=cryptol:cryptol . /cryptol
|
|
|
|
USER cryptol
|
|
|
|
WORKDIR /cryptol
|
2021-09-29 02:23:16 +03:00
|
|
|
RUN mkdir -p rootfs/usr/local/bin
|
|
|
|
WORKDIR /cryptol/rootfs/usr/local/bin
|
2023-07-11 20:32:45 +03:00
|
|
|
# The URL here is based on the same logic used to specify BIN_ZIP_FILE in
|
|
|
|
# `.github/workflow/ci.yml`, but specialized to x86-64 Ubuntu.
|
2024-02-12 18:21:43 +03:00
|
|
|
RUN curl -o solvers.zip -sL "https://github.com/GaloisInc/what4-solvers/releases/download/snapshot-20240212/ubuntu-22.04-X64-bin.zip"
|
2021-09-29 02:23:16 +03:00
|
|
|
RUN unzip solvers.zip && rm solvers.zip && chmod +x *
|
|
|
|
WORKDIR /cryptol
|
2022-08-13 14:36:50 +03:00
|
|
|
ENV PATH=/cryptol/rootfs/usr/local/bin:/home/cryptol/.local/bin:/home/cryptol/.ghcup/bin:$PATH
|
2021-09-29 02:23:16 +03:00
|
|
|
RUN z3 --version
|
2020-07-14 20:58:38 +03:00
|
|
|
ARG CRYPTOLPATH="/cryptol/.cryptol"
|
|
|
|
ENV LANG=C.UTF-8 \
|
|
|
|
LC_ALL=C.UTF-8
|
2024-01-04 21:03:45 +03:00
|
|
|
COPY cabal.GHC-${GHCVER}.config cabal.project.freeze
|
2022-08-13 14:36:50 +03:00
|
|
|
RUN mkdir -p /home/cryptol/.local/bin && \
|
2024-05-20 17:04:46 +03:00
|
|
|
curl -L https://downloads.haskell.org/~ghcup/0.1.22.0/x86_64-linux-ghcup-0.1.22.0 -o /home/cryptol/.local/bin/ghcup && \
|
2022-08-13 14:36:50 +03:00
|
|
|
chmod +x /home/cryptol/.local/bin/ghcup
|
|
|
|
RUN mkdir -p /home/cryptol/.ghcup && \
|
|
|
|
ghcup --version && \
|
2024-01-04 21:03:45 +03:00
|
|
|
ghcup install cabal ${CABALVER} && \
|
|
|
|
ghcup install ghc ${GHCVER} && \
|
|
|
|
ghcup set ghc ${GHCVER}
|
2020-08-28 01:58:43 +03:00
|
|
|
RUN cabal v2-update && \
|
|
|
|
cabal v2-build -j cryptol:exe:cryptol && \
|
|
|
|
cp $(cabal v2-exec which cryptol) rootfs/usr/local/bin && \
|
|
|
|
cabal v2-install --install-method=copy --overwrite-policy=always --installdir=bin test-lib
|
2020-07-14 20:58:38 +03:00
|
|
|
RUN ./bin/test-runner --ext=.icry --exe=./rootfs/usr/local/bin/cryptol -F -b tests
|
|
|
|
ENV PATH=/usr/local/bin:/cryptol/rootfs/usr/local/bin:$PATH
|
2020-09-30 23:45:09 +03:00
|
|
|
RUN ! $(cryptol -c ":s prover=yices" | tail -n +2 | grep -q .) \
|
2020-08-28 01:58:43 +03:00
|
|
|
# && ! $(cryptol -c ":s prover=mathsat" | tail -n +2 | grep -q .) \
|
2020-07-14 02:47:25 +03:00
|
|
|
&& ! $(cryptol -c ":s prover=cvc4" | tail -n +2 | grep -q .) \
|
2023-02-28 00:38:48 +03:00
|
|
|
&& ! $(cryptol -c ":s prover=cvc5" | tail -n +2 | grep -q .) \
|
2021-09-29 02:23:16 +03:00
|
|
|
&& ! $(cryptol -c ":s prover=abc" | tail -n +2 | grep -q .) \
|
|
|
|
# && ! $(cryptol -c ":s prover=boolector" | tail -n +2 | grep -q .) \
|
2020-07-14 02:47:25 +03:00
|
|
|
&& ! $(cryptol -c ":s prover=z3" | tail -n +2 | grep -q .)
|
2020-07-14 20:58:38 +03:00
|
|
|
RUN mkdir -p rootfs/"${CRYPTOLPATH}" \
|
|
|
|
&& cp -r lib/* rootfs/"${CRYPTOLPATH}"
|
|
|
|
USER root
|
|
|
|
RUN chown -R root:root /cryptol/rootfs
|
2020-07-14 02:47:25 +03:00
|
|
|
|
2022-08-13 14:36:50 +03:00
|
|
|
FROM ubuntu:22.04
|
2019-04-17 01:16:24 +03:00
|
|
|
RUN apt-get update \
|
2022-08-13 14:36:50 +03:00
|
|
|
&& apt-get install -y libgmp10 libgomp1 libffi8 libncurses6 libtinfo6 libreadline8 \
|
2020-05-14 20:50:22 +03:00
|
|
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
2020-07-14 20:58:38 +03:00
|
|
|
RUN useradd -m cryptol && chown -R cryptol:cryptol /home/cryptol
|
2018-06-26 21:10:28 +03:00
|
|
|
COPY --from=build /cryptol/rootfs /
|
|
|
|
USER cryptol
|
2020-07-14 20:58:38 +03:00
|
|
|
ENV LANG=C.UTF-8 \
|
|
|
|
LC_ALL=C.UTF-8
|
2018-06-26 21:10:28 +03:00
|
|
|
ENTRYPOINT ["/usr/local/bin/cryptol"]
|