-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
140 lines (116 loc) · 3.83 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
136
137
138
139
140
# Base stage
FROM ubuntu:18.04 as base
WORKDIR /root
RUN set -ex \
&& apt-get update \
&& apt-get --no-install-recommends --yes install \
ca-certificates \
build-essential \
gdb \
autoconf \
automake \
libtool \
pkg-config \
libpcre* \
zlib* \
libpq-dev \
libpqxx-dev \
curl \
git \
valgrind
# CMake
ARG CMAKE_VERSION_DOT=3.17.0
ARG CMAKE_HASH=b44685227b9f9be103e305efa2075a8ccf2415807fbcf1fc192da4d36aacc9f5
RUN set -ex \
&& curl -L -o cmake-${CMAKE_VERSION_DOT}-Linux-x86_64.tar.gz \
https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION_DOT}/cmake-${CMAKE_VERSION_DOT}-Linux-x86_64.tar.gz \
&& echo "${CMAKE_HASH} cmake-${CMAKE_VERSION_DOT}-Linux-x86_64.tar.gz" | sha256sum -c \
&& tar -xvf cmake-${CMAKE_VERSION_DOT}-Linux-x86_64.tar.gz \
&& cd cmake-${CMAKE_VERSION_DOT}-Linux-x86_64 \
&& cp -r bin/* /usr/local/bin/ \
&& cp -r doc/* /usr/local/doc/ \
&& cp -r man/* /usr/local/man/ \
&& cp -r share/* /usr/local/share/ \
&& cd ..
# OpenSSL
RUN apt-get --no-install-recommends --yes install libssl-dev
# Boost
ARG BOOST_VERSION=1_72_0
ARG BOOST_VERSION_DOT=1.72.0
ARG BOOST_HASH=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722
RUN set -ex \
&& curl -L -o boost_${BOOST_VERSION}.tar.bz2 \
https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
&& tar -xvf boost_${BOOST_VERSION}.tar.bz2 \
&& cd boost_${BOOST_VERSION}/tools/build \
&& ./bootstrap.sh \
&& ./b2 install --prefix=/usr/local \
&& cd ../.. \
&& b2 --build-dir=/tmp/build-boost toolset=gcc stage \
&& b2 install
ENV BOOST_ROOT /usr/local/boost_${BOOST_VERSION}
# Poco
ARG POCO_VERSION_DOT=1.10.1
ARG POCO_HASH=7f5931e0bb06bc2880a0f3867053a2fddf6c0d3e5dd96342a665460301fc34ca
RUN set -ex \
&& curl -L -o poco-${POCO_VERSION_DOT}-all.tar.gz \
https://pocoproject.org/releases/poco-${POCO_VERSION_DOT}/poco-${POCO_VERSION_DOT}-all.tar.gz \
&& echo "${POCO_HASH} poco-${POCO_VERSION_DOT}-all.tar.gz" | sha256sum -c \
&& tar -xvf poco-${POCO_VERSION_DOT}-all.tar.gz \
&& cd poco-${POCO_VERSION_DOT}-all \
&& ./configure \
&& make \
&& make install \
&& ldconfig \
&& cd ..
# LMDB
RUN apt-get --no-install-recommends --yes install liblmdb++-dev
# Secp256k1
RUN git clone https://github.com/libbitcoin/secp256k1.git \
&& cd secp256k1 \
&& git checkout 1c3616f9f6f8ec4cd88eaccbae08b8cbb04ea326 \
&& ./autogen.sh \
&& ./configure --enable-module-recovery \
&& make \
&& make install \
&& ldconfig \
&& cd ..
# Libbitcoin system
RUN git clone https://github.com/libbitcoin/libbitcoin-system.git \
&& cd libbitcoin-system \
&& git checkout bef130bdc8c57808dceab99d6867f3c58acf4e92 \
&& ./autogen.sh \
&& ./configure \
&& make \
&& make install \
&& ldconfig \
&& cd ..
# Cleanup
RUN rm -fr ./*
# Dev stage
FROM base AS dev
WORKDIR /usr/src/conclave
COPY . .
# CLion stage
FROM base AS clion-dev
RUN apt-get install -y ssh rsync
RUN ( \
echo 'LogLevel DEBUG2'; \
echo 'PermitRootLogin yes'; \
echo 'PasswordAuthentication yes'; \
echo 'Subsystem sftp /usr/lib/openssh/sftp-server'; \
) > /etc/ssh/sshd_config_test_clion \
&& mkdir /run/sshd
RUN useradd -m conclave && yes bitcoin | passwd conclave
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config_test_clion"]
# Build stage
FROM dev AS build
RUN set -ex \
&& make \
&& make test
# Run stage
FROM base AS run
COPY --from=build /usr/src/conclave/cmake-build-debug/bin/* /usr/bin
COPY --from=build /usr/src/conclave/etc/* /etc
CMD ["conclaved", "--config-file", "/etc/conclaved-config.json"]