|
| 1 | +ARG jdk_build=https://download.java.net/java/GA/jdk15.0.2/0d1cfde4252546c6931946de8db48ee2/7/GPL/openjdk-15.0.2_linux-x64_bin.tar.gz |
| 2 | + |
| 3 | +########################### |
| 4 | +# Base image for building # |
| 5 | +########################### |
| 6 | + |
| 7 | +FROM ubuntu:20.04 AS base |
| 8 | + |
| 9 | +ARG DEBIAN_FRONTEND=noninteractive |
| 10 | + |
| 11 | +RUN apt-get update && \ |
| 12 | + apt-get install -y \ |
| 13 | + build-essential m4 libgmp-dev libmpfr-dev \ |
| 14 | + pkg-config flex bison z3 libz3-dev maven \ |
| 15 | + python3 cmake gcc clang-8 lld-8 llvm-8-tools \ |
| 16 | + zlib1g-dev libboost-test-dev libyaml-dev \ |
| 17 | + libjemalloc-dev wget git curl |
| 18 | + |
| 19 | +# install a custom version of openjdk |
| 20 | +ARG jdk_build |
| 21 | +RUN mkdir jdk-install && \ |
| 22 | + cd jdk-install && \ |
| 23 | + wget -q --show-progress $jdk_build && \ |
| 24 | + tar xf *.tar.* && \ |
| 25 | + mv jdk-* /opt/jdk && \ |
| 26 | + cd .. && \ |
| 27 | + rm -r jdk-install |
| 28 | +ENV PATH="/opt/jdk/bin:${PATH}" |
| 29 | + |
| 30 | +# install haskell |
| 31 | +RUN curl -sSL https://get.haskellstack.org/ | sh |
| 32 | + |
| 33 | +##################### |
| 34 | +# Build K framework # |
| 35 | +##################### |
| 36 | + |
| 37 | +FROM base AS build |
| 38 | + |
| 39 | +# clone the K repo |
| 40 | +ADD deps/k /k |
| 41 | + |
| 42 | +# the submodules should already be checked out |
| 43 | +# git submodule update --init --recursive --depth 1 |
| 44 | + |
| 45 | +# build k |
| 46 | +RUN cd k && mvn package --batch-mode dependency:go-offline -T 1C -DskipTests |
| 47 | + |
| 48 | +# strip symbols not used for relocation |
| 49 | +RUN cd /k/k-distribution/target/release/k && \ |
| 50 | + strip --strip-unneeded bin/* $(find lib/kllvm -name "*") | exit 0 |
| 51 | + |
| 52 | +# remove some less used binaries |
| 53 | +RUN cd /k/k-distribution/target/release/k/bin/ && \ |
| 54 | + rm -f kore-format kore-prof kore-repl |
| 55 | + |
| 56 | +# pack a custom jvm with only the components we need |
| 57 | +RUN deps=$(jdeps --ignore-missing-deps --print-module-deps k/k-distribution/target/release/k/lib/kframework/java/*.jar) && \ |
| 58 | + jlink --output /jre \ |
| 59 | + --strip-debug \ |
| 60 | + --no-header-files \ |
| 61 | + --no-man-pages \ |
| 62 | + --compress=2 \ |
| 63 | + --add-modules $deps |
| 64 | + |
| 65 | +################################################### |
| 66 | +# Pack final image with only runtime dependencies # |
| 67 | +################################################### |
| 68 | + |
| 69 | +FROM ubuntu:20.04 |
| 70 | + |
| 71 | +ARG DEBIAN_FRONTEND=noninteractive |
| 72 | + |
| 73 | +RUN apt-get update && \ |
| 74 | + apt-get install --no-install-recommends -y \ |
| 75 | + tcc libc-dev flex bison z3 python3 python3-pip \ |
| 76 | + libjemalloc-dev metamath && \ |
| 77 | + rm -rf /var/lib/apt/lists/* && \ |
| 78 | + ln -s /usr/bin/tcc /usr/bin/gcc |
| 79 | + |
| 80 | +COPY --from=build /jre /opt/jre |
| 81 | +COPY --from=build /k/k-distribution/target/release/k/bin /opt/k/bin |
| 82 | +COPY --from=build /k/k-distribution/target/release/k/lib /opt/k/lib |
| 83 | +COPY --from=build /k/k-distribution/target/release/k/include /opt/k/include |
| 84 | + |
| 85 | +ENV PATH="/opt/k/bin:/opt/jre/bin:${PATH}" |
| 86 | + |
| 87 | +WORKDIR /opt/matching-logic-proof-checker |
| 88 | +ADD ml ml |
| 89 | +ADD scripts scripts |
| 90 | +ADD tests tests |
| 91 | +ADD theory theory |
| 92 | +ADD requirements.txt requirements.txt |
| 93 | +ADD requirements-dev.txt requirements-dev.txt |
| 94 | + |
| 95 | +RUN python3 -m pip install -r requirements.txt |
0 commit comments