Skip to content

Commit

Permalink
fixup alpine 0.91 and alpine 0.20
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
willcl-ark committed Sep 5, 2023
1 parent 4c2a44e commit 1747426
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
17 changes: 11 additions & 6 deletions 0.19/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN make install
RUN rm -rf ${BERKELEYDB_PREFIX}/docs

# Build stage for Bitcoin Core
FROM alpine as bitcoin-core
FROM alpine:3.13.0 as bitcoin-core

COPY --from=berkeleydb /opt /opt

Expand Down Expand Up @@ -79,6 +79,12 @@ RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/incl
--with-daemon
RUN make -j4
RUN make install

# copy libs needed to run on latest alpine
RUN mkdir /staging-libs && \
ldd ${BITCOIN_PREFIX}/bin/bitcoind | awk '$1 ~ /^\// {print $1} $3 ~ /^\// {print $3}' | \
while read -r lib; do cp "$lib" /staging-libs/; done

RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx
RUN strip ${BITCOIN_PREFIX}/bin/bitcoind
Expand All @@ -98,16 +104,15 @@ RUN addgroup -S bitcoin
RUN adduser -G bitcoin -H -S bitcoin
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add \
boost-chrono \
boost-filesystem \
boost-system \
boost-thread \
libevent \
libressl \
libzmq \
shadow \
su-exec

# Copy libraries from the builder stage
RUN mkdir -p /usr/local/lib
COPY --from=bitcoin-core /staging-libs/* /usr/local/lib/

ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV BITCOIN_VERSION=0.19.1
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
Expand Down
15 changes: 10 additions & 5 deletions 0.20/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN make install
RUN rm -rf ${BERKELEYDB_PREFIX}/docs

# Build stage for Bitcoin Core
FROM alpine as bitcoin-core
FROM alpine:3.13.0 as bitcoin-core

COPY --from=berkeleydb /opt /opt

Expand Down Expand Up @@ -78,6 +78,11 @@ RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/incl
--with-daemon
RUN make -j4
RUN make install

# copy libs needed to run on latest alpine
RUN mkdir /staging-libs && \
ldd ${BITCOIN_PREFIX}/bin/bitcoind | awk '$1 ~ /^\// {print $1} $3 ~ /^\// {print $3}' | \
while read -r lib; do cp "$lib" /staging-libs/; done
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx
RUN strip ${BITCOIN_PREFIX}/bin/bitcoind
Expand All @@ -97,14 +102,14 @@ RUN addgroup -S bitcoin
RUN adduser -G bitcoin -H -S bitcoin
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add \
boost-filesystem \
boost-system \
boost-thread \
libevent \
libzmq \
shadow \
su-exec

# Copy libraries from the builder stage
RUN mkdir -p /usr/local/lib
COPY --from=bitcoin-core /staging-libs/* /usr/local/lib/

ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV BITCOIN_VERSION=0.20.1
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
Expand Down

0 comments on commit 1747426

Please sign in to comment.