-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathServerDockerfile
93 lines (77 loc) · 3.91 KB
/
ServerDockerfile
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
FROM makarius/isabelle:Isabelle2024
# https://hub.docker.com/r/makarius/isabelle
ARG SCALA_VERSION
ENV SCALA_VERSION ${SCALA_VERSION:-2.13.14}
USER root
RUN apt-get update && \
apt-get install -y vim less curl wget rsync openssh-client git rpm unzip zip \
apt-transport-https libfontconfig1 libgomp1 pwgen build-essential sudo && \
apt-get clean
RUN adduser isabelle sudo
# USER isabelle
# RUN curl -fsL https://isabelle.in.tum.de/dist/Isabelle2024_linux.tar.gz > Isabelle.tar.gz
# RUN tar xzf Isabelle.tar.gz && rm Isabelle.tar.gz && mv Isabelle2024 Isabelle
# # RUN sed -i -e 's@ISABELLE_HOME_USER=.*@ISABELLE_HOME_USER="/isa"@g' Isabelle/etc/settings
# RUN Isabelle/bin/isabelle build -b HOL
# USER root
RUN ln -sT /home/isabelle/Isabelle/bin/isabelle /usr/local/bin/isabelle
# Install Java 21 from Eclipse Adoptium.
RUN mkdir -p /etc/apt/keyrings
RUN curl -fs https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc
RUN echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb \
$(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
RUN apt-get update && \
apt-get install -y temurin-21-jdk && \
apt-get clean
# Install Scala (and warm up cache).
RUN curl -fsL https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | tar xfz - -C /usr/share && \
mv /usr/share/scala-* /usr/share/scala && chown -R root:root /usr/share/scala && chmod -R 755 /usr/share/scala && \
ln -s /usr/share/scala/bin/* /usr/local/bin && \
echo "println(util.Properties.versionMsg)" > test.scala && scala test.scala && rm test.scala
# Install mill (alternative build system for scala, simpler than sbt; also warm up cache).
RUN curl -fsL https://github.com/com-lihaoyi/mill/releases/download/0.11.7/0.11.7 > /usr/local/bin/mill && \
chmod ugo+x /usr/local/bin/mill && \
touch build.sc && mill -i resolve _ && rm build.sc
# Install scala-isabelle branch (optional, you can use version v0.4.2 in build.sc instead, with Java 17).
## Install sbt.
RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list
RUN curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" \
| gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import && \
chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
RUN apt-get update && \
apt-get install -y sbt && \
apt-get clean
## Clone and compile scala-isabelle.
RUN mkdir /scala-isabelle
RUN chown isabelle:isabelle /scala-isabelle
USER isabelle
WORKDIR /scala-isabelle
RUN git clone -b test2024 --single-branch https://github.com/marcinwrochna/scala-isabelle.git /scala-isabelle
# RUN git clone -b master --single-branch https://github.com/dominique-unruh/scala-isabelle.git /scala-isabelle
# RUN echo "sbt.version = 1.10.0" >project/build.properties # Bump sbt version to allow working with Java 21.
RUN sbt publishLocal
# End of optional install of scala-isabelle branch.
USER root
RUN mkdir /qisabelle-server
RUN chown isabelle:isabelle /qisabelle-server
USER isabelle
WORKDIR /qisabelle-server
# Cache dependencies.
COPY ./.mill-version .
COPY ./build.sc .
RUN mill server.compile
# Compile.
COPY server/ server/
RUN mill server.compile
RUN mill server.assembly
RUN mill show server.assembly
# RUN mill server.test.compile
RUN echo -e "ISABELLE_DIR=/home/isabelle/Isabelle\nAFP_DIR=/afp" > .env
# When running inside Docker, listen to all interfaces, Docker determines real access.
ENV QISABELLE_HOST="0.0.0.0"
ENV QISABELLE_PORT=17000
EXPOSE 17000
# RUN mill server.test # Only a few tests that don't require mounts can be done here.
ENTRYPOINT []
CMD ["java", "-jar", "out/server/assembly.dest/out.jar"]