forked from smartbch/smartbch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.mainnet
More file actions
79 lines (60 loc) · 2.47 KB
/
Dockerfile.mainnet
File metadata and controls
79 lines (60 loc) · 2.47 KB
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
FROM ubuntu:20.04
MAINTAINER Josh Ellithorpe <quest@mac.com>
ARG SMARTBCH_VERSION="0.3.4"
ARG MOEINGEVM_VERSION="0.3.2"
# Update file limit
RUN sed -i -e '$a* soft nofile 65536\n* hard nofile 65536' /etc/security/limits.conf
# Install apt based dependencies
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get -y update && apt-get -y upgrade
RUN apt-get -y install cmake gcc-8 g++-8 gcc g++ git libgflags-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev make vim wget
# Setup build directory
RUN mkdir /build
WORKDIR /build
# Install Go
RUN wget https://dl.google.com/go/go1.16.5.linux-amd64.tar.gz
RUN tar zxvf go1.16.5.linux-amd64.tar.gz
RUN mv go /usr/local
RUN mkdir -p /go/bin
ENV GOROOT=/usr/local/go
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH
# Patch Go for larger cgo stack size
RUN wget https://github.com/smartbch/patch-cgo-for-golang/archive/refs/tags/v0.1.1.tar.gz
RUN tar zxvf v0.1.1.tar.gz
RUN rm v0.1.1.tar.gz
RUN cd patch-cgo-for-golang-0.1.1 && cp *.c $GOROOT/src/runtime/cgo/
# Build libsnappy
RUN wget https://github.com/google/snappy/archive/refs/tags/1.1.8.tar.gz
RUN tar zxvf 1.1.8.tar.gz
RUN cd snappy-1.1.8 && mkdir build && cd build && cmake -DBUILD_SHARED_LIBS=On ../ && make && make install
# Build rocksdb
RUN wget https://github.com/facebook/rocksdb/archive/refs/tags/v5.18.4.tar.gz
RUN tar zxvf v5.18.4.tar.gz
RUN cd rocksdb-5.18.4 && make CC=gcc-8 CXX=g++-8 shared_lib
ENV ROCKSDB_PATH="/build/rocksdb-5.18.4"
ENV CGO_CFLAGS="-I/$ROCKSDB_PATH/include"
ENV CGO_LDFLAGS="-L/$ROCKSDB_PATH -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd"
ENV LD_LIBRARY_PATH=$ROCKSDB_PATH:/usr/local/lib
# Create smartbch directory
RUN mkdir /smart_bch
WORKDIR /smart_bch
# Build libevmwrap.so
RUN git clone -b v${MOEINGEVM_VERSION} --depth 1 https://github.com/smartbch/moeingevm
RUN cd moeingevm/evmwrap && make
ENV EVMWRAP=/smart_bch/moeingevm/evmwrap/host_bridge/libevmwrap.so
# Build smartbchd
RUN git clone -b v${SMARTBCH_VERSION} --depth 1 https://github.com/smartbch/smartbch
RUN cd smartbch && go build -tags cppbtree github.com/smartbch/smartbch/cmd/smartbchd
# Setup smartbchd
RUN cp /smart_bch/smartbch/smartbchd /build/smartbchd
WORKDIR /root
RUN /build/smartbchd init mynode --chain-id 0x2710
RUN wget https://github.com/smartbch/artifacts/releases/download/v0.0.3/dot.smartbchd.tgz
RUN tar zxvf dot.smartbchd.tgz
RUN cp -rf dot.smartbchd/* .smartbchd/
# Go back to main workdir.
WORKDIR /build
VOLUME ["/root/.smartbchd"]
ENTRYPOINT ["./smartbchd"]
EXPOSE 8545 8546