11# Multistage docker build, requires docker 17.05
22
3+ ARG ALPINE_TAG=3.20
4+
35# Builder stage
4- FROM alpine:edge as builder
6+ FROM alpine:${ALPINE_TAG} as builder
57
68ARG MONERO_TAG
79RUN test -n "${MONERO_TAG}"
810
911RUN set -ex && \
1012 apk update && \
11- apk upgrade --no-cache && \
12- apk add --no-cache \
13+ apk upgrade && \
14+ apk add \
1315 autoconf \
1416 automake \
17+ boost-dev \
18+ clang-dev \
1519 cmake \
20+ cppzmq \
1621 curl \
1722 doxygen \
1823 file \
19- g++ \
2024 gettext \
2125 git \
2226 go \
2327 gperf \
28+ graphviz-dev \
29+ hidapi-dev \
30+ icu-data-full \
2431 libtool \
32+ libsodium-dev \
33+ libudev-zero-dev \
34+ libusb-dev \
2535 linux-headers \
36+ llvm-libunwind-dev \
2637 make \
38+ openssl-dev \
2739 patch \
2840 perl \
2941 python3 \
42+ qt5-qttools-dev \
43+ rapidjson-dev \
44+ readline-dev \
45+ samurai \
46+ unbound-dev \
47+ zeromq-dev \
3048 zlib-dev
3149
32- # Alpine doesn't package this anymore, and it's been archived on github.
33- # This is dirty and won't last forever. It might be worth embedding soon.
34- RUN apk add --no-cache \
35- --repository=http://dl-cdn.alpinelinux.org/alpine/v3.16/main \
36- libexecinfo-dev
37-
3850# Build the fixuid tool
3951RUN set -ex && \
4052 go install github.com/boxboat/
[email protected] && \
@@ -48,38 +60,59 @@ RUN git clone \
4860
4961WORKDIR /usr/src/monero
5062
51- # This is patched on master, but didn't make it into this release.
52- COPY epee.stdint.patch epee.stdint.patch
53- RUN patch -p1 < epee.stdint.patch
54-
55- # Set flags that make it possible to compile against musl.
56- ENV CFLAGS="-fPIC -DELPP_FEATURE_CRASH_LOG -DSTACK_TRACE=OFF"
57- ENV CXXFLAGS="-fPIC -DELPP_FEATURE_CRASH_LOG -DSTACK_TRACE=OFF"
58- ENV LDFLAGS="-Wl,-V"
63+ # patches needed to work with alpine
64+ COPY patches patches
65+ RUN set -ex && \
66+ patch -p1 < patches/easylogging.patch && \
67+ patch -p1 < patches/epee.patch && \
68+ patch -p1 < patches/miniupnpc.patch && \
69+ patch -p1 < patches/monero.patch
5970
60- # Build dependencies and monero, but like, be nice about it.
61- RUN nice -n 19 \
71+ # Build monero, but like, be nice about it.
72+ RUN set -ex && \
73+ cmake \
74+ -Wno-dev \
75+ -B build \
76+ -G Ninja \
77+ -D ARCH="x86-64" \
78+ -D BUILD_64=on \
79+ -D BUILD_TAG="linux-x64" \
80+ -D BUILD_TESTS=off \
81+ -D MANUAL_SUBMODULES=1 \
82+ -D STACK_TRACE=off \
83+ -D CMAKE_BUILD_TYPE=Release \
84+ -D CMAKE_C_COMPILER=clang \
85+ -D CMAKE_CXX_COMPILER=clang++ \
86+ -D CMAKE_INSTALL_PREFIX=/usr \
87+ && \
88+ nice -n 19 \
6289 ionice -c2 -n7 \
63- make -j${NPROC:-$(( $(nproc) - 1 ))} depends target=x86_64-linux-gnu
90+ cmake --build build
6491
6592
6693# Runtime stage
67- FROM alpine:edge as runtime
94+ FROM alpine:${ALPINE_TAG} as runtime
6895
6996RUN set -ex && \
7097 apk update && \
7198 apk upgrade --no-cache && \
7299 apk add --no-cache \
73- ca-certificates
74-
75- # Alpine doesn't package this anymore, and it's been archived on github.
76- # This is dirty and won't last forever. It might be worth embedding soon.
77- RUN apk add --no-cache \
78- --repository=http://dl-cdn.alpinelinux.org/alpine/v3.16/main \
79- libexecinfo
100+ boost \
101+ ca-certificates \
102+ hidapi \
103+ libsodium-dev \
104+ libudev-zero \
105+ libusb \
106+ llvm-libunwind \
107+ openssl \
108+ rapidjson \
109+ readline \
110+ unbound \
111+ zeromq \
112+ zlib
80113
81114COPY --from=builder /root/go/bin/fixuid /usr/local/bin/fixuid
82- COPY --from=builder /usr/src/monero/build/x86_64-linux-gnu/release/ bin/* /usr/local/bin/
115+ COPY --from=builder /usr/src/monero/build/bin/* /usr/local/bin/
83116
84117# Create a dedicated user and configure fixuid
85118ARG MONERO_USER="monero"
0 commit comments