From c4e53860a708dc617ccf5a7b3210116ff04cdee1 Mon Sep 17 00:00:00 2001 From: djkazic Date: Wed, 16 Jul 2025 11:32:24 -0400 Subject: [PATCH] build: reintroduce docker CI --- .github/workflows/publish-docker-image.yml | 40 +++++++++++++++ Dockerfile | 60 ++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/publish-docker-image.yml create mode 100644 Dockerfile diff --git a/.github/workflows/publish-docker-image.yml b/.github/workflows/publish-docker-image.yml new file mode 100644 index 000000000000..73eca7525192 --- /dev/null +++ b/.github/workflows/publish-docker-image.yml @@ -0,0 +1,40 @@ +name: Docker CI +on: + push: + tags: + - 'libre-relay-v29.0*' + +jobs: + build: + name: Build and push to GitHub Container Registry + runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + steps: + - name: Set VERSION + run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin + + - name: Setup Docker buildx + run: docker buildx create --use + + - name: Run Docker buildx + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --build-arg VERSION=${{ env.VERSION }} \ + --tag ghcr.io/${{ github.repository }}:${{ env.VERSION }} \ + --push . + + - name: Rebuild for latest tag + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --build-arg VERSION=${{ env.VERSION }} \ + --tag ghcr.io/${{ github.repository }}:latest \ + --push . \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000000..45fa99c69161 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +# Build stage +FROM debian:bookworm-slim AS builder + +# Install build dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + cmake \ + libboost-all-dev \ + libevent-dev \ + libtool \ + pkg-config \ + libzmq3-dev \ + libsqlite3-dev \ + # python3 - only needed if running test suite + # optional for UPnP support: + # libminiupnpc-dev \ + # optional for NAT-PMP support: + # libnatpmp-dev \ + && rm -rf /var/lib/apt/lists/* + +# Copy local bitcoin source +WORKDIR /build +COPY . . + +# Build Bitcoin Core +RUN cmake -B build \ + -DCMAKE_INSTALL_PREFIX=/build \ + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/build/bin \ + -DINSTALL_MAN=OFF \ + -DBUILD_SHARED_LIBS=OFF \ + -DWITH_CCACHE=OFF \ + -DBUILD_TESTS=OFF \ + -DREDUCE_EXPORTS=ON \ + -DBUILD_UTIL=ON \ + -DBUILD_WALLET_TOOL=ON \ + -DWITH_ZMQ=ON +RUN cmake --build build + +# Final stage +FROM debian:bookworm-slim + +# Install runtime dependencies +RUN apt-get update && apt-get install -y \ + libevent-2.1-7 \ + libevent-extra-2.1-7 \ + libevent-pthreads-2.1-7 \ + libzmq5 \ + libsqlite3-0 \ + libdb5.3++ \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /build/bin/bitcoind /bin +COPY --from=builder /build/bin/bitcoin-cli /bin + +ENV HOME=/data +VOLUME /data/.bitcoin + +EXPOSE 8332 8333 18332 18333 18443 18444 + +ENTRYPOINT ["bitcoind"]