Skip to content

Commit ef2d802

Browse files
authored
Merge pull request #31 from willcl-ark/reduce-mem-master
2 parents 19e573e + c617205 commit ef2d802

File tree

3 files changed

+59
-10
lines changed

3 files changed

+59
-10
lines changed

.github/workflows/master.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
include:
16+
platform: [linux/amd64, linux/arm64]
17+
variant:
1718
- type: ""
1819
suffix: ""
1920
- type: "-alpine"
@@ -25,11 +26,19 @@ jobs:
2526
uses: docker/setup-qemu-action@v3
2627
- name: Set up Docker Buildx
2728
uses: docker/setup-buildx-action@v3
29+
with:
30+
buildkitd-flags: --debug
31+
- name: Cache Docker layers
32+
uses: actions/cache@v4
33+
with:
34+
path: /tmp/.buildx-cache
35+
key: ${{ runner.os }}-buildx-${{ matrix.platform }}-${{ matrix.variant.type }}-${{ github.sha }}
36+
restore-keys: |
37+
${{ runner.os }}-buildx-${{ matrix.platform }}-${{ matrix.variant.type }}-
2838
2939
- name: Prepare Docker build
3040
id: prepare
3141
run: |
32-
PLATFORMS="linux/amd64,linux/arm64"
3342
REPO="bitcoin/bitcoin"
3443
BRANCH="master"
3544
PUSH="false"
@@ -38,10 +47,10 @@ jobs:
3847
fi
3948
4049
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | tee -a $GITHUB_OUTPUT
41-
echo "docker_platforms=${PLATFORMS}" | tee -a $GITHUB_OUTPUT
50+
echo "docker_platforms=${{ matrix.platform }}" | tee -a $GITHUB_OUTPUT
4251
echo "docker_username=bitcoin" | tee -a $GITHUB_OUTPUT
4352
echo "push=${PUSH}" | tee -a $GITHUB_OUTPUT
44-
echo "tags=${REPO}:nightly${{ matrix.type }}" | tee -a $GITHUB_OUTPUT
53+
echo "tags=${REPO}:nightly${{ matrix.variant.type }}" | tee -a $GITHUB_OUTPUT
4554
4655
- name: Login into Docker Hub
4756
uses: docker/login-action@v3
@@ -66,7 +75,15 @@ jobs:
6675
docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \
6776
--output "type=image,push=${{ steps.prepare.outputs.push }}" \
6877
--progress=plain \
78+
--cache-from "type=local,src=/tmp/.buildx-cache" \
79+
--cache-to "type=local,dest=/tmp/.buildx-cache-new,mode=max" \
6980
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
7081
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
7182
$(printf "%s" "${TAGS[@]/#/ --tag }" ) \
72-
master${{ matrix.suffix }}
83+
master${{ matrix.variant.suffix }}
84+
85+
# Temp fix
86+
# https://github.com/docker/build-push-action/issues/252
87+
# https://github.com/moby/buildkit/issues/1896
88+
rm -rf /tmp/.buildx-cache
89+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

master/Dockerfile

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,21 @@ FROM debian:bookworm-slim AS build
33
LABEL maintainer.0="Will Clark (@willcl-ark)"
44

55
RUN apt-get update -y \
6-
&& 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 \
6+
&& apt-get install -y \
7+
build-essential \
8+
ca-certificates \
9+
ccache \
10+
clang-16 \
11+
cmake \
12+
git \
13+
libboost-dev \
14+
libevent-dev \
15+
libsqlite3-dev \
16+
libzmq3-dev \
17+
pkg-config \
18+
python3 \
19+
systemtap-sdt-dev \
20+
--no-install-recommends \
721
&& apt-get clean \
822
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
923

@@ -13,7 +27,15 @@ RUN git clone -b "master" --single-branch --depth 1 "https://github.com/bitcoin/
1327
WORKDIR /src/bitcoin
1428

1529
RUN set -ex \
16-
&& 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}" \
30+
&& cmake -B build \
31+
-DBUILD_TESTS=OFF \
32+
-DBUILD_TX=ON \
33+
-DBUILD_UTIL=OFF \
34+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
35+
-DCMAKE_CXX_COMPILER=clang++-16 \
36+
-DCMAKE_C_COMPILER=clang-16 \
37+
-DCMAKE_INSTALL_PREFIX:PATH="${BITCOIN_PREFIX}" \
38+
-DWITH_CCACHE=ON \
1739
&& cmake --build build -j$(nproc) \
1840
&& strip build/src/bitcoin-cli build/src/bitcoin-tx build/src/bitcoind \
1941
&& cmake --install build

master/alpine/Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Build stage for Bitcoin Core
2-
FROM alpine:3.20 AS build
2+
FROM alpine:3.21 AS build
33

44
RUN apk --no-cache add \
55
boost-dev \
66
build-base \
7+
ccache \
78
chrpath \
9+
clang18 \
810
cmake \
911
file \
1012
gnupg \
@@ -21,13 +23,21 @@ WORKDIR /src
2123
RUN git clone -b "master" --single-branch --depth 1 "https://github.com/bitcoin/bitcoin.git"
2224
WORKDIR /src/bitcoin
2325

24-
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}" && \
26+
RUN cmake -B build \
27+
-DBUILD_TESTS=OFF \
28+
-DBUILD_TX=ON \
29+
-DBUILD_UTIL=OFF \
30+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
31+
-DCMAKE_CXX_COMPILER=clang++-18 \
32+
-DCMAKE_C_COMPILER=clang-18 \
33+
-DCMAKE_INSTALL_PREFIX:PATH="${BITCOIN_PREFIX}" \
34+
-DWITH_CCACHE=ON && \
2535
cmake --build build -j$(nproc) && \
2636
strip build/src/bitcoin-cli build/src/bitcoin-tx build/src/bitcoind && \
2737
cmake --install build
2838

2939
# Copy build artefacts
30-
FROM alpine:3.20
40+
FROM alpine:3.21
3141

3242
ARG UID=100
3343
ARG GID=101

0 commit comments

Comments
 (0)