-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from willcl-ark/nightly-debian
- Loading branch information
Showing
6 changed files
with
144 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,46 @@ | ||
# Build stage for Bitcoin Core | ||
FROM alpine:3.20 AS build | ||
|
||
RUN apk --no-cache add \ | ||
boost-dev \ | ||
build-base \ | ||
chrpath \ | ||
cmake \ | ||
file \ | ||
gnupg \ | ||
git \ | ||
libevent-dev \ | ||
libressl \ | ||
libtool \ | ||
linux-headers \ | ||
sqlite-dev \ | ||
zeromq-dev | ||
FROM debian:bookworm-slim AS build | ||
|
||
LABEL maintainer.0="Will Clark (@willcl-ark)" | ||
|
||
RUN apt-get update -y \ | ||
&& apt-get install -y build-essential git ca-certificates cmake pkg-config python3 libevent-dev libboost-dev libsqlite3-dev libzmq3-dev systemtap-sdt-dev --no-install-recommends \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
ENV BITCOIN_PREFIX=/opt/bitcoin | ||
WORKDIR /src | ||
RUN git clone -b "master" --single-branch --depth 1 "https://github.com/bitcoin/bitcoin.git" | ||
WORKDIR /src/bitcoin | ||
|
||
RUN cmake -B build -DBUILD_TESTS=OFF -DBUILD_UTIL=OFF -DBUILD_TX=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DWITH_CCACHE=OFF -DCMAKE_INSTALL_PREFIX:PATH="${BITCOIN_PREFIX}" && \ | ||
cmake --build build -j$(nproc) && \ | ||
strip build/src/bitcoin-cli build/src/bitcoin-tx build/src/bitcoind && \ | ||
cmake --install build | ||
RUN set -ex \ | ||
&& cmake -B build -DBUILD_TESTS=OFF -DBUILD_UTIL=OFF -DBUILD_TX=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DWITH_CCACHE=OFF -DCMAKE_INSTALL_PREFIX:PATH="${BITCOIN_PREFIX}" \ | ||
&& cmake --build build -j$(nproc) \ | ||
&& strip build/src/bitcoin-cli build/src/bitcoin-tx build/src/bitcoind \ | ||
&& cmake --install build | ||
|
||
# Copy build artefacts | ||
FROM alpine:3.20 | ||
# Second stage | ||
FROM debian:bookworm-slim | ||
|
||
ARG UID=100 | ||
ARG UID=101 | ||
ARG GID=101 | ||
|
||
LABEL maintainer.0="Will Clark (@willcl-ark)" | ||
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin | ||
|
||
RUN addgroup --gid ${GID} --system bitcoin && \ | ||
adduser --uid ${UID} --system bitcoin --ingroup bitcoin | ||
RUN apk --no-cache add \ | ||
bash \ | ||
libevent \ | ||
libzmq \ | ||
shadow \ | ||
sqlite-libs \ | ||
su-exec | ||
RUN groupadd --gid ${GID} bitcoin \ | ||
&& useradd --create-home --no-log-init -u ${UID} -g ${GID} bitcoin \ | ||
&& apt-get update -y \ | ||
&& apt-get install -y libevent-dev libboost-dev libsqlite3-dev libzmq3-dev systemtap-sdt-dev --no-install-recommends \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin | ||
COPY --from=build /opt/bitcoin /opt | ||
ENV PATH=/opt/bin:$PATH | ||
|
||
COPY --from=build /opt/bitcoin /opt | ||
COPY docker-entrypoint.sh /entrypoint.sh | ||
|
||
VOLUME ["/home/bitcoin/.bitcoin"] | ||
|
||
EXPOSE 8332 8333 18332 18333 18443 18444 38333 38332 | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
RUN bitcoind -version | grep "Bitcoin Core version" | ||
CMD ["bitcoind"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Build stage for Bitcoin Core | ||
FROM alpine:3.20 AS build | ||
|
||
RUN apk --no-cache add \ | ||
boost-dev \ | ||
build-base \ | ||
chrpath \ | ||
cmake \ | ||
file \ | ||
gnupg \ | ||
git \ | ||
libevent-dev \ | ||
libressl \ | ||
libtool \ | ||
linux-headers \ | ||
sqlite-dev \ | ||
zeromq-dev | ||
|
||
ENV BITCOIN_PREFIX=/opt/bitcoin | ||
WORKDIR /src | ||
RUN git clone -b "master" --single-branch --depth 1 "https://github.com/bitcoin/bitcoin.git" | ||
WORKDIR /src/bitcoin | ||
|
||
RUN cmake -B build -DBUILD_TESTS=OFF -DBUILD_UTIL=OFF -DBUILD_TX=ON -DCMAKE_BUILD_TYPE=MinSizeRel -DWITH_CCACHE=OFF -DCMAKE_INSTALL_PREFIX:PATH="${BITCOIN_PREFIX}" && \ | ||
cmake --build build -j$(nproc) && \ | ||
strip build/src/bitcoin-cli build/src/bitcoin-tx build/src/bitcoind && \ | ||
cmake --install build | ||
|
||
# Copy build artefacts | ||
FROM alpine:3.20 | ||
|
||
ARG UID=100 | ||
ARG GID=101 | ||
|
||
LABEL maintainer.0="Will Clark (@willcl-ark)" | ||
|
||
RUN addgroup --gid ${GID} --system bitcoin && \ | ||
adduser --uid ${UID} --system bitcoin --ingroup bitcoin | ||
RUN apk --no-cache add \ | ||
bash \ | ||
libevent \ | ||
libzmq \ | ||
shadow \ | ||
sqlite-libs \ | ||
su-exec | ||
|
||
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin | ||
ENV PATH=/opt/bin:$PATH | ||
|
||
COPY --from=build /opt/bitcoin /opt | ||
COPY docker-entrypoint.sh /entrypoint.sh | ||
|
||
VOLUME ["/home/bitcoin/.bitcoin"] | ||
|
||
EXPOSE 8332 8333 18332 18333 18443 18444 38333 38332 | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
CMD ["bitcoind"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ -n "${UID+x}" ] && [ "${UID}" != "0" ]; then | ||
usermod -u "$UID" bitcoin | ||
fi | ||
|
||
if [ -n "${GID+x}" ] && [ "${GID}" != "0" ]; then | ||
groupmod -g "$GID" bitcoin | ||
fi | ||
|
||
echo "$0: assuming uid:gid for bitcoin:bitcoin of $(id -u bitcoin):$(id -g bitcoin)" | ||
|
||
if [ "$(echo "$1" | cut -c1)" = "-" ]; then | ||
echo "$0: assuming arguments for bitcoind" | ||
|
||
set -- bitcoind "$@" | ||
fi | ||
|
||
if [ "$(echo "$1" | cut -c1)" = "-" ] || [ "$1" = "bitcoind" ]; then | ||
mkdir -p "$BITCOIN_DATA" | ||
chmod 700 "$BITCOIN_DATA" | ||
# Fix permissions for home dir. | ||
chown -R bitcoin:bitcoin "$(getent passwd bitcoin | cut -d: -f6)" | ||
# Fix permissions for bitcoin data dir. | ||
chown -R bitcoin:bitcoin "$BITCOIN_DATA" | ||
|
||
echo "$0: setting data directory to $BITCOIN_DATA" | ||
|
||
set -- "$@" -datadir="$BITCOIN_DATA" | ||
fi | ||
|
||
if [ "$1" = "bitcoind" ] || [ "$1" = "bitcoin-cli" ] || [ "$1" = "bitcoin-tx" ]; then | ||
echo | ||
exec su-exec bitcoin "$@" | ||
fi | ||
|
||
echo | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters