Skip to content

Commit

Permalink
Add Dockerfile for Bitcoin CAT
Browse files Browse the repository at this point in the history
  • Loading branch information
tiero committed Apr 16, 2024
0 parents commit 469401d
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Docker

on:
push:
# Publish `master` as Docker `latest` image.
branches:
- master

env:
# TODO: Change variable to your image's name.
IMAGE_NAME: bitcoin-cat

jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"

steps:
- uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build image
run: >-
docker buildx build --push
--tag ghcr.io/vulpemventures/$IMAGE_NAME:latest
--platform linux/arm64,linux/amd64 .
79 changes: 79 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Define the base image for the build stage
FROM debian:stable-slim as builder

# Set ARGs for build-time variables
ARG VERSION=dont-success-cat
ARG REPO_URL=https://github.com/rot13maxi/bitcoin.git

# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
automake \
pkg-config \
libtool \
autotools-dev \
bsdmainutils \
python3 \
git \
libboost-system-dev \
libboost-filesystem-dev \
libboost-thread-dev \
libevent-dev \
libsqlite3-dev \
libdb-dev \
libdb++-dev \
libzmq3-dev && \
rm -rf /var/lib/apt/lists/*

# Clone the repository at the specified version
RUN git clone --branch $VERSION $REPO_URL /bitcoin-source
WORKDIR /bitcoin-source

# Build the dependencies and configure settings
RUN ./autogen.sh && \
./configure \
CXXFLAGS="-O2" \
--disable-man \
--disable-shared \
--disable-ccache \
--disable-tests \
--enable-static \
--enable-reduce-exports \
--without-gui \
--without-libs \
--with-utils \
--with-zmq \
--with-sqlite=yes \
--with-incompatible-bdb && \
make -j$(nproc)

# Install the binaries to a separate directory
RUN make install DESTDIR=/bitcoin-dist

# Start the final stage for a smaller, cleaner image
FROM debian:stable-slim

# Install runtime dependencies, cleanup and create linux user bitcoin
RUN apt-get update && apt-get install -y \
libboost-system-dev \
libboost-filesystem-dev \
libboost-thread-dev \
libevent-dev \
libzmq3-dev \
libsqlite3-dev \
libdb-dev \
libdb++-dev && \
rm -rf /var/lib/apt/lists/* \
&& useradd -ms /bin/bash bitcoin

USER bitcoin
WORKDIR /home/bitcoin

# Copy the built binaries from the builder stage
COPY --from=builder /bitcoin-dist/usr/local /usr/local

# Prepare the data directory
RUN mkdir -p "$HOME/.bitcoin/"

# Set the entrypoint to the bitcoind daemon
ENTRYPOINT ["bitcoind"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Vulpem Ventures

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Docker bitcoin

Dockerfile of the public image [ghcr.io/vulpemventures/bitcoin-cat:latest](https://github.com/orgs/vulpemventures/packages/container/package/bitcoin-cat)


Pull the image:

```bash
$ docker pull ghcr.io/vulpemventures/bitcoin-cat:latest
```

Run the image:

```bash
$ docker run -v path/to/bitcoin.conf:/home/bitcoin/.bitcoin -d ghcr.io/vulpemventures/bitcoin-cat:latest
```


## Release

To tag a new image with a new version, change the branch in Dockerfile and push it to the repository.

0 comments on commit 469401d

Please sign in to comment.