feat: multi platform support
- use build platform argument Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# Build stage for Bitcoin Core
|
||||
FROM alpine as bitcoin-core
|
||||
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM}} alpine:3.18 as bitcoin-core
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
|
||||
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
|
||||
RUN apk add \
|
||||
@@ -71,7 +74,7 @@ RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/incl
|
||||
--with-libs \
|
||||
--with-sqlite=yes \
|
||||
--with-daemon
|
||||
RUN make -j`nproc`
|
||||
RUN make -j $(nproc)
|
||||
RUN make install
|
||||
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli
|
||||
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx
|
||||
@@ -79,8 +82,8 @@ RUN strip ${BITCOIN_PREFIX}/bin/bitcoind
|
||||
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.a
|
||||
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.so.0.0.0
|
||||
|
||||
# Build stage for compiled artifacts
|
||||
FROM alpine
|
||||
# Runtime binaries and setup stage
|
||||
FROM --platform=${TARGETPLATFORM:-${BUILDPLATFORM}} alpine:3.18 as runner
|
||||
|
||||
ARG UID=100
|
||||
ARG GID=101
|
||||
@@ -100,8 +103,8 @@ RUN apk --no-cache add \
|
||||
libzmq
|
||||
|
||||
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
|
||||
ENV BITCOIN_VERSION=23.0
|
||||
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
|
||||
ARG BITCOIN_VERSION=23.0
|
||||
ARG BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
|
||||
|
||||
COPY --from=bitcoin-core ${BITCOIN_PREFIX}/bin/bitcoin-cli /usr/bin/bitcoin-cli
|
||||
COPY --from=bitcoin-core ${BITCOIN_PREFIX}/bin/bitcoin-tx /usr/bin/bitcoin-tx
|
||||
@@ -115,7 +118,7 @@ COPY assets/bitcoin.conf /bitcoin.conf
|
||||
COPY bitcoind/healthcheck.sh /healthcheck.sh
|
||||
RUN chmod +x /healthcheck.sh
|
||||
|
||||
VOLUME ["/home/bitcoin/.bitcoin"]
|
||||
VOLUME ["${BITCOIN_DATA}"]
|
||||
|
||||
EXPOSE 8332 8333 18332 18333 18444
|
||||
|
||||
@@ -124,7 +127,7 @@ RUN chown -R bitcoin:bitcoin "${BITCOIN_DATA}"
|
||||
|
||||
USER bitcoin
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh" ]
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
RUN bitcoind -version | grep "Bitcoin Core version v${BITCOIN_VERSION}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user