Skip to content

Commit 1747426

Browse files
committed
fixup alpine 0.91 and alpine 0.20
It seems that alpine:latest updated gcc, which causes build errors on old versions. Therefore use an old alpine image to build, and copt needed runtime libraries across with the binaries.
1 parent 4c2a44e commit 1747426

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

0.19/alpine/Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RUN make install
2323
RUN rm -rf ${BERKELEYDB_PREFIX}/docs
2424

2525
# Build stage for Bitcoin Core
26-
FROM alpine as bitcoin-core
26+
FROM alpine:3.13.0 as bitcoin-core
2727

2828
COPY --from=berkeleydb /opt /opt
2929

@@ -79,6 +79,12 @@ RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/incl
7979
--with-daemon
8080
RUN make -j4
8181
RUN make install
82+
83+
# copy libs needed to run on latest alpine
84+
RUN mkdir /staging-libs && \
85+
ldd ${BITCOIN_PREFIX}/bin/bitcoind | awk '$1 ~ /^\// {print $1} $3 ~ /^\// {print $3}' | \
86+
while read -r lib; do cp "$lib" /staging-libs/; done
87+
8288
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli
8389
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx
8490
RUN strip ${BITCOIN_PREFIX}/bin/bitcoind
@@ -98,16 +104,15 @@ RUN addgroup -S bitcoin
98104
RUN adduser -G bitcoin -H -S bitcoin
99105
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
100106
RUN apk --no-cache add \
101-
boost-chrono \
102-
boost-filesystem \
103-
boost-system \
104-
boost-thread \
105-
libevent \
106107
libressl \
107108
libzmq \
108109
shadow \
109110
su-exec
110111

112+
# Copy libraries from the builder stage
113+
RUN mkdir -p /usr/local/lib
114+
COPY --from=bitcoin-core /staging-libs/* /usr/local/lib/
115+
111116
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
112117
ENV BITCOIN_VERSION=0.19.1
113118
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}

0.20/alpine/Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RUN make install
2323
RUN rm -rf ${BERKELEYDB_PREFIX}/docs
2424

2525
# Build stage for Bitcoin Core
26-
FROM alpine as bitcoin-core
26+
FROM alpine:3.13.0 as bitcoin-core
2727

2828
COPY --from=berkeleydb /opt /opt
2929

@@ -78,6 +78,11 @@ RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/incl
7878
--with-daemon
7979
RUN make -j4
8080
RUN make install
81+
82+
# copy libs needed to run on latest alpine
83+
RUN mkdir /staging-libs && \
84+
ldd ${BITCOIN_PREFIX}/bin/bitcoind | awk '$1 ~ /^\// {print $1} $3 ~ /^\// {print $3}' | \
85+
while read -r lib; do cp "$lib" /staging-libs/; done
8186
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli
8287
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx
8388
RUN strip ${BITCOIN_PREFIX}/bin/bitcoind
@@ -97,14 +102,14 @@ RUN addgroup -S bitcoin
97102
RUN adduser -G bitcoin -H -S bitcoin
98103
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
99104
RUN apk --no-cache add \
100-
boost-filesystem \
101-
boost-system \
102-
boost-thread \
103-
libevent \
104105
libzmq \
105106
shadow \
106107
su-exec
107108

109+
# Copy libraries from the builder stage
110+
RUN mkdir -p /usr/local/lib
111+
COPY --from=bitcoin-core /staging-libs/* /usr/local/lib/
112+
108113
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
109114
ENV BITCOIN_VERSION=0.20.1
110115
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}

0 commit comments

Comments
 (0)