forked from viperproject/prusti-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
80 lines (72 loc) · 2.51 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
FROM ubuntu:18.04
MAINTAINER Federico Poli "federico.poli@inf.ethz.ch"
ENV DEBIAN_FRONTEND noninteractive
# Install prerequisites
RUN apt-get update && \
apt-get install -y \
build-essential \
cmake \
curl \
default-jdk \
file \
gcc \
git \
libssl-dev \
locales \
mono-complete \
pkg-config \
python3 \
sudo \
unzip \
wget \
&& \
rm -rf /var/lib/apt/lists/*
# Set up locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Set up Java
ENV JAVA_HOME /usr/lib/jvm/default-java
ENV LD_LIBRARY_PATH $JAVA_HOME/lib/server/
# Install Rust
ADD rust-toolchain /tmp/rust-toolchain
RUN CHANNEL=$(cat /tmp/rust-toolchain | grep channel | cut -d'"' -f2) && \
echo "Rust toolchain: $CHANNEL" && \
curl https://sh.rustup.rs -sSf \
| sh -s -- -y --profile minimal --no-modify-path --default-toolchain "$CHANNEL"
ENV PATH /root/.cargo/bin:$PATH
# Set up Prusti
ADD . /opt/prusti-dev
RUN cd /opt/prusti-dev && \
./x.py setup && \
rm -rf /var/lib/apt/lists/*
# Build and install Prusti
RUN cd /opt/prusti-dev && \
./x.py build --release && \
mkdir -p /usr/local/prusti/deps/ && \
cp -r viper_tools/ /usr/local/prusti/ && \
cp rust-toolchain /usr/local/prusti/ && \
cp target/release/prusti-driver /usr/local/prusti/ && \
cp target/release/prusti-server-driver /usr/local/prusti/ && \
cp target/release/prusti-server /usr/local/prusti/ && \
cp target/release/prusti-rustc /usr/local/prusti/ && \
cp target/release/cargo-prusti /usr/local/prusti/ && \
cp target/release/libprusti_contracts.rlib /usr/local/prusti/ && \
cp target/release/deps/libprusti_contracts_internal-* /usr/local/prusti/deps/ && \
rm -rf target
ENV PATH "/usr/local/prusti/:${PATH}"
# Check on a few crates that Prusti works
WORKDIR /root
RUN cargo new good-example && \
cd good-example && \
sed -i '1s/^/use prusti_contracts::*;\n/;s/println.*$/assert!(true);/' src/main.rs && \
echo 'prusti-contracts = { path = "/opt/prusti-dev/prusti-contracts" }' >> Cargo.toml && \
cargo build && cargo clean && \
cargo prusti && cargo clean
RUN cargo new bad-example && \
cd bad-example && \
sed -i '1s/^/use prusti_contracts::*;\n/;s/println.*$/assert!(false);/' src/main.rs && \
echo 'prusti-contracts = { path = "/opt/prusti-dev/prusti-contracts" }' >> Cargo.toml && \
cargo build && cargo clean && \
! cargo prusti && cargo clean