From 5b530f08776ef05e09a429358ccf1c4196399810 Mon Sep 17 00:00:00 2001 From: Sosthene Date: Tue, 8 Jul 2025 16:09:03 +0200 Subject: [PATCH] init commit --- .github/workflows/cicd.yml | 43 +++++++++++++++++++++++++++ Dockerfile | 61 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 .github/workflows/cicd.yml create mode 100644 Dockerfile diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..f225e71 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,43 @@ +name: Build and Push to Registry + +on: + push: + branches: [ master ] + +env: + REGISTRY: git.4nkweb.com + IMAGE_NAME: 4nk/bitcoin + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up SSH agent + uses: webfactory/ssh-agent@v0.9.1 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.USER }} + password: ${{ secrets.TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + ssh: default + build-args: | + ENV_VARS=${{ secrets.ENV_VARS }} + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e039eec --- /dev/null +++ b/Dockerfile @@ -0,0 +1,61 @@ +FROM alpine:3.15 as build + +ARG BITCOIN_TAG=24.0.1 + +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories +RUN apk update && apk --no-cache add autoconf \ + automake \ + boost-dev \ + build-base \ + chrpath \ + file \ + gnupg \ + libevent-dev \ + libressl \ + libtool \ + linux-headers \ + sqlite-dev \ + git + +RUN git clone https://github.com/bitcoin/bitcoin.git -b v$BITCOIN_TAG /src/bitcoin + +WORKDIR /src/bitcoin + +RUN ./autogen.sh +RUN ./configure --with-gui=no \ + --with-daemon \ + --without-miniupnpc \ + --without-bdb \ + --disable-zmq \ + --disable-man \ + --enable-util-cli \ + --disable-static \ + --disable-bench \ + --disable-fuzz-binary \ + --with-sqlite=yes +RUN make -j$(nproc) +RUN make check +RUN make install +RUN strip /usr/local/bin/bitcoin-cli +RUN strip /usr/local/bin/bitcoind +RUN strip /usr/local/bin/bitcoin-util +RUN strip /usr/local/lib/libbitcoinconsensus.so.0.0.0 + +# Build stage for compiled artifacts +FROM alpine:3.15 + +RUN addgroup -S -g 1000 bitcoin +RUN adduser -G bitcoin -S -u 1000 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 \ + libevent \ + su-exec + +COPY --from=build /usr/local/bin/bitcoind /usr/local/bin/bitcoin-cli /usr/local/bin/bitcoin-util /usr/local/bin/ +COPY --from=build /usr/local/lib/* /usr/local/lib/ +COPY --from=build /usr/local/include/* /usr/local/include/ +COPY --from=build /src/bitcoin/test/functional/test_framework/ /bitcoin/test/functional/test_framework + +USER bitcoin