forked from gussmith23/lakeroad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
135 lines (119 loc) · 3.69 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# syntax=docker/dockerfile-upstream:master-labs
# The above enables use of ADD of git repo.
FROM ubuntu:22.04
# Get add-apt-repository
RUN apt update
RUN apt install -y software-properties-common
# Add PPA for Racket
RUN add-apt-repository ppa:plt/racket
## Install dependencies
# apt dependencies
RUN apt install -y \
autoconf \
bison \
ccache \
cmake \
curl \
flex \
g++ \
git \
git \
libfl-dev \
libfl2 \
libgoogle-perftools-dev \
libssl-dev \
libzmq3-dev \
llvm-14 \
make \
numactl \
openssl \
perl \
perl-doc \
python3 \
python3-pip \
racket \
wget \
zlib1g \
zlib1g-dev
# Point to llvm-config binary. Alternatively, make sure you have a binary called
# `llvm-config` on your PATH.
ENV LLVM_CONFIG=llvm-config-14
# Make a binary for `lit`. If you're on Mac, you can install lit via Brew.
# Ubuntu doesn't have a binary for it, but it is available on pip and is
# installed later in this Dockerfile.
WORKDIR /root
RUN mkdir -p /root/.local/bin \
&& echo "#!/usr/bin/env python3" >> /root/.local/bin/lit \
&& echo "from lit.main import main" >> /root/.local/bin/lit \
&& echo "if __name__ == '__main__': main()" >> /root/.local/bin/lit \
&& chmod +x /root/.local/bin/lit
ENV PATH="/root/.local/bin:${PATH}"
# Build and install latest boolector.
WORKDIR /root
ARG MAKE_JOBS=2
RUN git clone https://github.com/boolector/boolector \
&& cd boolector \
&& git checkout 3.2.2 \
&& ./contrib/setup-lingeling.sh \
&& ./contrib/setup-btor2tools.sh \
&& ./configure.sh \
&& cd build \
&& make -j${MAKE_JOBS} install
# Install Yosys and other OSS hardware tools from prebuilt binaries.
#
# If we get an error here, we likely just need to add other branches for other
# architectures.
WORKDIR /root
RUN if [ "$(uname -m)" = "x86_64" ] ; then \
wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2022-03-23/oss-cad-suite-linux-x64-20220323.tgz -q -O oss-cad-suite.tgz; \
else \
exit 1; \
fi \
&& tar xf oss-cad-suite.tgz
ENV PATH="/root/oss-cad-suite/bin:${PATH}"
# Build and install latest Verilator.
ARG MAKE_JOBS=2
WORKDIR /root
RUN git clone https://github.com/verilator/verilator \
&& unset VERILATOR_ROOT \
&& cd verilator \
&& git checkout v4.222 \
&& autoconf \
&& ./configure \
&& make -j${MAKE_JOBS} \
&& make install
ENV VERILATOR_INCLUDE_DIR=/root/verilator/include
# pip dependencies
WORKDIR /root/lakeroad
ADD requirements.txt requirements.txt
RUN pip install -r requirements.txt
# raco (Racket) dependencies
# First, fix https://github.com/racket/racket/issues/2691
RUN raco setup --doc-index --force-user-docs
RUN raco pkg install --deps search-auto --batch \
fmt \
rosette \
yaml
# Install Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:$PATH"
ENV LAKEROAD_DIR=/root/lakeroad
ENV PYTHONPATH="${LAKEROAD_DIR}/python:${PYTHONPATH}"
# Build Rust package.
WORKDIR /root/lakeroad
ADD ./rust ./rust
RUN cargo build --manifest-path /root/lakeroad/rust/Cargo.toml
# Add other Lakeroad files. It's useful to put this as far down as possible. In
# general, only ADD files just before they're needed. This maximizes the ability
# to cache intermediate containers and minimizes rebuilding.
#
# In reality, we use the git functionality of ADD (enabled in our case via the
# optional flag --keep-git-dir) to add all of the checked-in files of the
# Lakeroad repo (but not including the .git directory itself). We could cut this
# down further if we wanted, but I think this is a clean approach for now.
WORKDIR /root/lakeroad
ADD --keep-git-dir=false . .
# Build Racket bytecode; makes Lakeroad much faster.
RUN raco make /root/lakeroad/bin/main.rkt
WORKDIR /root/lakeroad
CMD [ "/bin/bash", "run-tests.sh" ]