-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
144 lines (117 loc) · 4.57 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
141
142
143
144
ARG BUILD_OUTPUT_DIR=cmake-docker-build-debug
#############################################
# builder image - contains all dependencies #
#############################################
FROM ubuntu:24.04@sha256:e3f92abc0967a6c19d0dfa2d55838833e947b9d74edbcb0113e48535ad4be12a as builder
# deps versions
ARG LLVM_VERSION=17
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# Install standard packages
RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
tzdata \
&& apt-get install -y \
tar \
git \
curl \
wget \
python3-pip \
lsb-release \
libgmp-dev \
libmpfr-dev \
libmicrohttpd-dev \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*
# install solc for py_test if arch is not arm64 because it is not availiable
# Install solc 0.8.24 as we do not support 0.8.25 yet
RUN \
if [ `arch` != "aarch64" ]; \
then \
curl -L -o solc-0.8.25 https://github.com/ethereum/solidity/releases/download/v0.8.25/solc-static-linux \
&& chmod +x solc-0.8.25 \
&& mv solc-0.8.25 /usr/bin/solc; \
fi
# install standart tools
RUN add-apt-repository ppa:ethereum/ethereum \
&& apt-get update \
&& apt-get install -y \
clang-format-$LLVM_VERSION \
clang-tidy-$LLVM_VERSION \
llvm-$LLVM_VERSION \
golang-go \
ca-certificates \
libtool \
autoconf \
binutils \
cmake \
ccache \
# this libs are required for arm build by go part
libzstd-dev \
libsnappy-dev \
# replace this with conan dependency
rapidjson-dev \
&& rm -rf /var/lib/apt/lists/*
ENV CXX="clang++-${LLVM_VERSION}"
ENV CC="clang-${LLVM_VERSION}"
# HACK remove this when update to conan 2.0
RUN ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang
RUN ln -s /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++
# Install conan
RUN apt-get remove -y python3-distro
RUN pip3 install conan==1.64.1 --break-system-packages
# Install conan deps
WORKDIR /opt/taraxa/
COPY conanfile.py .
RUN conan profile new clang --detect \
&& conan profile update settings.compiler=clang clang \
&& conan profile update settings.compiler.version=$LLVM_VERSION clang \
&& conan profile update settings.compiler.libcxx=libstdc++11 clang \
&& conan profile update settings.build_type=RelWithDebInfo clang \
&& conan profile update env.CC=clang-$LLVM_VERSION clang \
&& conan profile update env.CXX=clang++-$LLVM_VERSION clang \
&& conan install --build missing -pr=clang .
###################################################################
# Build stage - use builder image for actual build of taraxa node #
###################################################################
FROM builder as build
# Default output dir containing build artifacts
ARG BUILD_OUTPUT_DIR
# Build taraxa-node project
WORKDIR /opt/taraxa/
COPY . .
RUN mkdir $BUILD_OUTPUT_DIR && cd $BUILD_OUTPUT_DIR \
&& cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DTARAXA_ENABLE_LTO=OFF \
-DTARAXA_STATIC_BUILD=OFF \
../
RUN cd $BUILD_OUTPUT_DIR && make -j$(nproc) all \
# Copy CMake generated Testfile to be able to trigger ctest from bin directory
&& cp tests/CTestTestfile.cmake bin/;
# \
# keep only required shared libraries and final binaries
# && find . -maxdepth 1 ! -name "lib" ! -name "bin" -exec rm -rfv {} \;
# Set LD_LIBRARY_PATH so taraxad binary finds shared libs
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
###############################################################################
##### Taraxa image containing taraxad binary + dynamic libraries + config #####
###############################################################################
FROM ubuntu:24.04@sha256:e3f92abc0967a6c19d0dfa2d55838833e947b9d74edbcb0113e48535ad4be12a
# Install curl and jq
RUN apt-get update \
&& apt-get install -y curl jq python3 python3-pip python3-virtualenv \
&& rm -rf /var/lib/apt/lists/*
# Install required Python packages
RUN pip3 install click eth-account eth-utils typing-extensions --break-system-packages
ARG BUILD_OUTPUT_DIR
WORKDIR /root/.taraxa
# Copy required binaries
COPY --from=build /opt/taraxa/$BUILD_OUTPUT_DIR/bin/taraxad /usr/local/bin/taraxad
COPY --from=build /opt/taraxa/$BUILD_OUTPUT_DIR/bin/taraxa-bootnode /usr/local/bin/taraxa-bootnode
COPY --from=build /opt/taraxa/$BUILD_OUTPUT_DIR/lib/*.so* /usr/local/lib/
# Copy scripts
COPY scripts/taraxa-sign.py /usr/local/bin/taraxa-sign
# Set LD_LIBRARY_PATH so taraxad binary finds shared libs
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]