-
Notifications
You must be signed in to change notification settings - Fork 167
/
Dockerfile.m1
153 lines (124 loc) · 3.75 KB
/
Dockerfile.m1
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
ARG UBUNTU_IMAGE
ARG SOLC_IMAGE
FROM $SOLC_IMAGE as solc
RUN apk add make curl bash
COPY Makefile.docker ./Makefile
COPY sol/stdlib_reach.sol sol/stdlib_openzep.sol.sh ./sol/
COPY .docker-root ./.docker-root
RUN make ROOT=.docker-root sol/stdlib.json
FROM reachsh/devnet-algo:latest AS algo
FROM $UBUNTU_IMAGE as build-base
RUN set -e
RUN apt-get update \
&& apt-get install -y \
curl \
gcc \
git \
libnuma-dev \
llvm \
make \
python3 \
wget \
xz-utils \
z3 \
zlib1g-dev
FROM build-base as build-hs
WORKDIR /tmp
RUN curl https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-aarch64-deb10-linux.tar.xz \
-o ghc.tar.xz \
&& mkdir ghc/ \
&& tar -xvf ghc.tar.xz -C ghc/ \
&& cd ghc/ghc-8.10.7/ \
&& ./configure \
&& make install \
&& cd ../.. \
&& rm -r ghc/ \
&& rm ghc.tar.xz
RUN curl -sSL https://github.com/commercialhaskell/stack/releases/download/v2.7.1/stack-2.7.1-linux-aarch64.bin > /usr/local/bin/stack && chmod +x /usr/local/bin/stack
ENV LANG=C.UTF-8
RUN mkdir /tmp/hs
WORKDIR /tmp/hs
# mostly copied form haskell-build-artifacts
COPY .docker-root ./.docker-root
COPY Makefile.docker ./Makefile
COPY package.open.yaml ./
RUN make ROOT=.docker-root install-mo package.yaml
# stack.yaml.lock intentionally omitted
COPY stack.yaml ./
RUN echo 'compiler: ghc-8.10.7' >> stack.yaml \
&& echo 'system-ghc: true' >> stack.yaml
RUN stack update
RUN stack build --dependencies-only
COPY hie.yaml Setup.hs ./
ADD app ./app/
ADD rsh ./rsh/
ADD smt2 ./smt2/
COPY --from=solc ./sol/stdlib.sol ./sol/stdlib.sol
ADD src ./src/
ADD test ./test/
RUN make ROOT=.docker-root src/Reach/Version.hs
SHELL ["/bin/bash", "-c"]
RUN set -o pipefail ; stack build 2>&1 | tee build-log.txt
RUN stack build --copy-bins
# RUN mv "$(stack path --local-install-root)/bin" /build/bin/
FROM build-base as build-z3
RUN apt-get update && apt-get install -y \
python3-distutils \
clang
WORKDIR /tmp_z3
ARG Z3_VERSION
ENV Z3_VERSION=${Z3_VERSION}
# ENV Z3_SYS x64-glibc-2.31
# RUN wget -O /tmp/z3.zip \
# https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VERSION}/z3-${Z3_VERSION}-${Z3_SYS}.zip \
# && unzip -p /tmp/z3.zip z3-${Z3_VERSION}-${Z3_SYS}/bin/z3 | cat > /usr/bin/z3 \
# && rm /tmp/z3.zip
RUN git clone https://github.com/Z3Prover/z3
WORKDIR /tmp_z3/z3
RUN git checkout "z3-${Z3_VERSION}"
RUN python3 scripts/mk_make.py
WORKDIR /tmp_z3/z3/build
RUN make
RUN make install
FROM build-hs as build
WORKDIR /
COPY --from=solc /usr/local/bin/solc /usr/bin/solc
RUN chmod +x /usr/bin/solc
COPY --from=solc /sol/stdlib.json /stdlib_sol.json
RUN cp /root/.local/bin/reachc /usr/bin/reachc && chmod +x /usr/bin/reachc
COPY --from=algo /bin/goal /usr/bin/goal
COPY --from=build-z3 /usr/bin/z3 /usr/bin/z3
# mostly copied from Dockerfile.reachc
WORKDIR /app
ENTRYPOINT ["/usr/bin/reachc"]
ARG REACH_GIT_HASH
ENV REACH_GIT_HASH="${REACH_GIT_HASH}"
ENV REACHC_HASH="${REACH_GIT_HASH}"
FROM $UBUNTU_IMAGE as reachc
RUN apt-get update && apt-get install -y \
libnuma1 \
musl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /usr/bin/solc /usr/bin/solc
COPY --from=build /usr/bin/goal /usr/bin/goal
COPY --from=build /usr/bin/z3 /usr/bin/z3
COPY --from=build /usr/bin/reachc /usr/bin/reachc
RUN chmod +x /usr/bin/reachc
COPY --from=solc /sol/stdlib.json /stdlib_sol.json
WORKDIR /app
ENTRYPOINT ["/usr/bin/reachc"]
ARG REACH_GIT_HASH
ENV REACH_GIT_HASH="${REACH_GIT_HASH}"
ENV REACHC_HASH="${REACH_GIT_HASH}"
EXPOSE 3001
FROM $UBUNTU_IMAGE as reach-cli
RUN apt-get update && apt-get install -y \
ca-certificates \
libnuma1 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /root/.local/bin/reach /usr/bin/reach
COPY app/reach/embed/ /app/embed/
WORKDIR /app/src
ENTRYPOINT ["/usr/bin/reach"]
ARG REACH_GIT_HASH
ENV REACH_GIT_HASH="${REACH_GIT_HASH}"