forked from chronicleprotocol/omnia
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
123 lines (97 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
FROM alpine:3.16 as rust-builder
ARG TARGETARCH
WORKDIR /opt
RUN apk add clang lld curl build-base linux-headers git \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh \
&& chmod +x ./rustup.sh \
&& ./rustup.sh -y
RUN [[ "$TARGETARCH" = "arm64" ]] && echo "export CFLAGS=-mno-outline-atomics" >> $HOME/.profile || true
WORKDIR /opt/foundry
ARG CAST_REF="master"
RUN git clone https://github.com/foundry-rs/foundry.git . \
&& git checkout --quiet ${CAST_REF}
RUN source $HOME/.profile && cargo build --release \
&& strip /opt/foundry/target/release/cast
FROM golang:1.18-alpine3.16 as go-builder
RUN apk --no-cache add git
ARG CGO_ENABLED=0
WORKDIR /go/src/omnia
ARG ETHSIGN_REF="master"
RUN git clone https://github.com/gsu-protocol/omnia.git . \
&& git checkout --quiet ${ETHSIGN_REF} \
&& cd ethsign \
&& go mod vendor \
&& go build .
# Building gofer & spire
WORKDIR /go/src/oracle-suite
ARG ORACLE_SUITE_REF="master"
RUN git clone https://github.com/gsu-protocol/oracle-suite.git . \
&& git checkout --quiet ${ORACLE_SUITE_REF}
RUN go mod vendor \
&& go build ./cmd/spire \
&& go build ./cmd/gofer \
&& go build ./cmd/ssb-rpc-client
FROM python:3.9-alpine3.16
ENV GLIBC_KEY=https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
ENV GLIBC_KEY_FILE=/etc/apk/keys/sgerrand.rsa.pub
ENV GLIBC_RELEASE=https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-2.35-r0.apk
RUN apk add --update --no-cache \
jq curl git make perl g++ ca-certificates parallel tree \
bash bash-doc bash-completion linux-headers gcompat git \
util-linux pciutils usbutils coreutils binutils findutils grep iproute2 \
nodejs \
&& apk add --no-cache -X https://dl-cdn.alpinelinux.org/alpine/edge/testing \
jshon agrep datamash
RUN wget -q -O ${GLIBC_KEY_FILE} ${GLIBC_KEY} \
&& wget -O glibc.apk ${GLIBC_RELEASE} \
&& apk add glibc.apk --force
COPY --from=rust-builder /opt/foundry/target/release/cast /usr/local/bin/cast
COPY --from=go-builder \
/go/src/omnia/ethsign/ethsign \
/go/src/oracle-suite/spire \
/go/src/oracle-suite/gofer \
/go/src/oracle-suite/ssb-rpc-client \
/usr/local/bin/
RUN pip install --no-cache-dir mpmath sympy ecdsa==0.16.0
COPY ./bin /opt/omnia/bin/
COPY ./exec /opt/omnia/exec/
COPY ./lib /opt/omnia/lib/
COPY ./version /opt/omnia/version
# Installing setzer
ARG SETZER_REF="master"
RUN git clone https://github.com/gsu-protocol/setzer.git \
&& cd setzer \
&& git checkout --quiet ${SETZER_REF} \
&& mkdir /opt/setzer/ \
&& cp -R libexec/ /opt/setzer/libexec/ \
&& cp -R bin /opt/setzer/bin \
&& cd .. \
&& rm -rf setzer
ENV HOME=/home/omnia
ENV OMNIA_CONFIG=${HOME}/omnia.json \
SPIRE_CONFIG=${HOME}/spire.json \
GOFER_CONFIG=${HOME}/gofer.json \
ETH_RPC_URL=http://geth.local:8545 \
ETH_GAS=7000000 \
CHLORIDE_JS='1'
COPY ./config/feed.json ${OMNIA_CONFIG}
COPY ./docker/spire/config/client_feed.json ${SPIRE_CONFIG}
COPY ./docker/gofer/client.json ${GOFER_CONFIG}
WORKDIR ${HOME}
COPY ./docker/keystore/ .ethereum/keystore/
COPY ./docker/ssb-server/config/manifest.json .ssb/manifest.json
COPY ./docker/ssb-server/config/secret .ssb/secret
COPY ./docker/ssb-server/config/config.json .ssb/config
ARG USER=1000
ARG GROUP=1000
RUN chown -R ${USER}:${GROUP} ${HOME}
USER ${USER}:${GROUP}
# Removing notification from `parallel`
RUN printf 'will cite' | parallel --citation 1>/dev/null 2>/dev/null; exit 0
# Setting up PATH for setzer and omnia bin folder
# Here we have set of different pathes included:
# - /opt/setzer - For `setzer` executable
# - /opt/omnia/bin - Omnia executables
# - /opt/omnia/exec - Omnia transports executables
ENV PATH="/opt/setzer/bin:/opt/omnia/bin:/opt/omnia/exec:/opt/setzer/bin:${PATH}"
CMD ["omnia"]