forked from gussmith23/churchroad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
118 lines (104 loc) · 3.23 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
# syntax=docker/dockerfile-upstream:master-labs
# The above enables use of ADD of git repo.
FROM ubuntu:22.04
ARG MAKE_JOBS=2
SHELL ["/bin/bash", "-c"]
# Update, get add-apt-repository.
RUN apt update \
&& apt install -y software-properties-common
# Install apt dependencies
# `noninteractive` prevents the tzdata package from asking for a timezone on the
# command line.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt install -y \
autoconf \
bison \
ccache \
cmake \
curl \
flex \
g++ \
git \
libboost-filesystem-dev \
libfl-dev \
libfl2 \
libgmp-dev \
libgoogle-perftools-dev \
libreadline-dev \
libssl-dev \
libzmq3-dev \
llvm-14 \
make \
ninja-build \
numactl \
openssl \
perl \
perl-doc \
pkg-config \
python3 \
python3-pip \
racket \
tcl \
tcl8.6-dev \
wget \
zlib1g \
zlib1g-dev
# Install Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:$PATH"
# Build Rust package.
WORKDIR /root/churchroad
# ADD has weird behavior when it comes to directories. That's why we need so
# many ADDs.
ADD egglog_src egglog_src
ADD src src
ADD tests tests
ADD Cargo.toml Cargo.toml
ADD Cargo.lock Cargo.lock
RUN cargo build
# Build Yosys.
WORKDIR /root
ARG MAKE_JOBS=2
ADD dependencies.sh .
RUN source /root/dependencies.sh \
&& mkdir yosys && cd yosys \
&& wget -qO- https://github.com/YosysHQ/yosys/archive/$YOSYS_COMMIT_HASH.tar.gz | tar xz --strip-components=1 \
&& PREFIX="/root/.local" CPLUS_INCLUDE_PATH="/usr/include/tcl8.6/:$CPLUS_INCLUDE_PATH" make config-gcc \
&& PREFIX="/root/.local" CPLUS_INCLUDE_PATH="/usr/include/tcl8.6/:$CPLUS_INCLUDE_PATH" make -j ${MAKE_JOBS} install \
&& rm -rf /root/yosys
# Add /root/.local/bin to PATH.
ENV PATH="/root/.local/bin:$PATH"
# Build Yosys plugin.
WORKDIR /root/churchroad/yosys-plugin
ADD yosys-plugin .
RUN make -j ${MAKE_JOBS}
# 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
# Point to llvm-config binary. Alternatively, make sure you have a binary called
# `llvm-config` on your PATH.
ENV LLVM_CONFIG=llvm-config-14
# Python dependencies.
WORKDIR /root/churchroad
ADD requirements.txt .
RUN pip install -r requirements.txt
ENV CHURCHROAD_DIR=/root/churchroad
# Add other Churchroad 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.
#
# 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 Churchroad 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/churchroad
ADD --keep-git-dir=false . .
WORKDIR /root/churchroad
ADD fmt.sh run-tests.sh ./
CMD [ "/bin/bash", "run-tests.sh" ]