-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile
135 lines (93 loc) · 4.79 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
ARG BRANCH=v0.3.3-alpha.1
ARG DOCKER_NAME=ghcr.io/fhenixprotocol/nitro/fhenix-node-builder:$BRANCH
FROM rust:1.74-slim-bullseye as warp-drive-builder
WORKDIR /workspace
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y make wget gpg software-properties-common zlib1g-dev libstdc++-10-dev wabt git
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
add-apt-repository 'deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-12 main' && \
apt-get update && \
apt-get install -y llvm-12-dev libclang-common-12-dev
ARG EXTRA_RUSTFLAGS="-C target-feature=+aes"
ENV EXTRA_RUSTFLAGS=$EXTRA_RUSTFLAGS
# Copy all the stuff needed to download all the packages
# so we don't have to download everything every time just to change something small
COPY warp-drive/fhe-engine/rust-toolchain warp-drive/fhe-engine/rust-toolchain
COPY warp-drive/fhe-engine/Cargo.toml warp-drive/fhe-engine/Cargo.toml
COPY warp-drive/fhe-engine/Cargo.lock warp-drive/fhe-engine/Cargo.lock
#COPY warp-drive/renault-server/Cargo.toml warp-drive/renault-server/Cargo.toml
#COPY warp-drive/renault-server/Cargo.lock warp-drive/renault-server/Cargo.lock
COPY warp-drive/fhe-bridge warp-drive/fhe-bridge
COPY warp-drive/sealing warp-drive/sealing
# Update rust version & install packages
RUN cd warp-drive/fhe-engine && cargo update
#RUN cd warp-drive/renault-server && cargo update
# Copy the rest of the stuff so we can actually build it
COPY warp-drive/ warp-drive/
WORKDIR /workspace/warp-drive/fhe-engine
# Todo: fix arm support
RUN RUSTFLAGS=$EXTRA_RUSTFLAGS cargo build --profile=release-lto
#WORKDIR /workspace/warp-drive/renault-server
# Todo: fix arm support
#RUN RUSTFLAGS=$EXTRA_RUSTFLAGS cargo build --profile=release-lto
FROM $DOCKER_NAME as winning
RUN echo $DOCKER_NAME
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update -qq && apt-get install -y nodejs npm yarn
RUN npm install -g pnpm
RUN rm -rf fheos/
RUN mkdir fheos/
COPY warp-drive fheos/warp-drive
COPY go-ethereum fheos/go-ethereum
COPY chains fheos/chains
COPY cmd fheos/cmd
COPY precompiles fheos/precompiles
COPY storage fheos/storage
COPY hooks fheos/hooks
RUN cd fheos/precompiles/ && pnpm install
COPY gen.sh fheos/
COPY gen.go fheos/
COPY go.mod fheos/
COPY go.sum fheos/
RUN mkdir -p fheos/solidity
WORKDIR fheos
RUN ./gen.sh
WORKDIR /workspace
RUN go mod tidy
RUN CGO_ENABLED=0 go install -ldflags "-s -w -extldflags '-static'" github.com/go-delve/delve/cmd/dlv@latest
RUN go build -gcflags "all=-N -l" -ldflags="-X github.com/offchainlabs/nitro/cmd/util/confighelpers.version= -X github.com/offchainlabs/nitro/cmd/util/confighelpers.datetime= -X github.com/offchainlabs/nitro/cmd/util/confighelpers.modified=" -o target/bin/nitro "/workspace/cmd/nitro"
COPY Makefile fheos/
RUN cd fheos && make build
FROM ghcr.io/fhenixprotocol/localfhenix:v0.1.0-beta5
# **************** setup dlv
ENV GOROOT=/usr/local/go
ENV GOPATH=/go/
ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
ADD https://go.dev/dl/go1.20.linux-amd64.tar.gz go.linux-amd64.tar.gz
RUN sudo tar -C /usr/local -xzf go.linux-amd64.tar.gz
RUN sudo chown user:user /usr/local/go
RUN sudo mkdir /go
RUN sudo chown user:user /go
RUN CGO_ENABLED=0 go install -ldflags "-s -w -extldflags '-static'" github.com/go-delve/delve/cmd/dlv@latest
# **************** setup fheos & warp drive
RUN rm -rf /home/user/fhenix/fheosdb
RUN mkdir -p /home/user/fhenix/fheosdb
COPY --from=warp-drive-builder /workspace/warp-drive/fhe-engine/target/release-lto/fhe-engine-server /usr/bin/fhe-engine-server
COPY --from=warp-drive-builder /workspace/warp-drive/fhe-engine/config/fhe_engine.toml /home/user/fhenix/fhe_engine.toml
#COPY --from=warp-drive-builder /workspace/warp-drive/renault-server/target/release-lto/renault-server /usr/bin/renault-server
#COPY --from=warp-drive-builder /workspace/warp-drive/renault-server/config/renault-server.toml /home/user/fhenix/renault-server.toml
COPY --from=winning /workspace/target/bin/nitro /usr/local/bin/
COPY --from=winning /workspace/fheos/build/main /usr/local/bin/fheos
# **************** setup scripts and configs
COPY deployment/run.sh run.sh
RUN sudo chmod +x ./run.sh
RUN sudo chown -R user:user /home/user/keys
RUN sed -i '/^keys_folder *=.*/s//keys_folder = "\/home\/user\/keys" /' /home/user/fhenix/fhe_engine.toml
#RUN sed -i '/^keys_folder *=.*/s//keys_folder = "\/home\/user\/keys" /' /home/user/fhenix/renault-server.toml
#RUN #sudo jq '.conf |= (.fhenix = .tfhe | del(.tfhe))' /config/sequencer_config.json > temp.json && sudo mv temp.json /config/sequencer_config.json
COPY deployment/sequencer_config.json /config/sequencer_config.json
# **************** Run
CMD ["./run.sh"]
#CMD ["./run.sh", "--debug"]