Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions contrib/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
# ElectrumX for Bitcoin with LevelDB
# Build: docker build -t electrumx .
# podman build -t electrumx .
# ElectrumX for Bitcoin, with RocksDB
# This is a simple ~minimal example Dockerfile.
#
# Build: docker build --pull -t electrumx .
# podman build --pull -t electrumx .
# Run: docker run -d --net=host -v ~/electrumx-db:/var/lib/electrumx -e DAEMON_URL="http://youruser:yourpass@localhost:8332" -e REPORT_SERVICES=tcp://example.com:50001 electrumx
# podman run -d --net=host -v ~/electrumx-db:/var/lib/electrumx -e DAEMON_URL="http://youruser:yourpass@localhost:8332" -e REPORT_SERVICES=tcp://example.com:50001 electrumx
# Stop: docker kill --signal=TERM CONTAINER_ID
# podman kill --signal=TERM CONTAINER_ID
# Stop: docker stop CONTAINER_ID
# podman stop CONTAINER_ID

FROM python:3.14.3-trixie AS builder
FROM python:3.14-trixie AS builder

WORKDIR /usr/src/app

# Install the libs needed by leveldb (including development headers)
# Install the libs needed by rocksdb (including development headers)
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
build-essential git libleveldb-dev \
build-essential \
git \
librocksdb-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

# Install ElectrumX
#ARG ELECTRUMX_VERSION=1.20.0
ARG ELECTRUMX_VERSION=b8f6e227f251fe5cba96b940ffaa094439636417
RUN python -m venv venv \
&& venv/bin/pip install --no-cache-dir \
"e-x @ git+https://github.com/spesmilo/electrumx.git@1.19.0"
"e_x[rocksdb] @ git+https://github.com/spesmilo/electrumx.git@${ELECTRUMX_VERSION}"


FROM python:3.14.3-slim-trixie
FROM python:3.14-slim-trixie

# Install the libs needed by leveldb (no development headers or statics)
RUN apt-get update && apt-get -y --no-install-recommends install libleveldb1d && rm -rf /var/lib/apt/lists/*
# Install the libs needed by rocksdb (no development headers or statics)
RUN apt-get update && apt-get -y --no-install-recommends install librocksdb9.10 && rm -rf /var/lib/apt/lists/*

ENV SERVICES="tcp://:50001"
ENV COIN=Bitcoin
ENV DB_DIRECTORY=/var/lib/electrumx
ENV DAEMON_URL="http://username:password@hostname:port/"
ENV ALLOW_ROOT=true
# TODO change DB_ENGINE default to rocksdb after we tag ElectrumX 2.0?
ENV DB_ENGINE=leveldb
ENV MAX_SEND=10000000
ENV BANDWIDTH_UNIT_COST=50000
ENV CACHE_MB=2000
ENV DB_ENGINE=rocksdb
#ENV CACHE_MB=2000

WORKDIR /usr/src/app
COPY --from=builder /usr/src/app .
Expand Down
82 changes: 82 additions & 0 deletions contrib/Dockerfile_beefyserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# ElectrumX for Bitcoin, with RocksDB
# This Dockerfile is intended for modern multi-core servers with at least 16 GB of RAM.
# We compile our own free-threaded Python, with --disable-gil (which is experimental!), which makes
# ElectrumX able to truly utilise multiple CPU cores and makes processing blocks significantly faster.
#
# Build: docker build -f Dockerfile_beefyserver --pull -t electrumx .
# Run: docker run -d --net=host -v ~/electrumx-db:/var/lib/electrumx -e DAEMON_URL="http://youruser:yourpass@localhost:8332" -e REPORT_SERVICES=tcp://example.com:50001 electrumx
# Stop: docker stop CONTAINER_ID

FROM debian:trixie

ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /usr/src/app

# Install libs needed to build CPython
RUN apt-get update \
&& apt-get -y install \
git \
wget \
make \
autotools-dev \
autoconf \
libtool \
xz-utils \
libssl-dev \
libssl3 \
openssl \
zlib1g-dev \
libffi-dev \
libncurses5-dev \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*

# Install libs needed to build RocksDB
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
build-essential \
git \
librocksdb-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

# build CPython (free-threaded, with --disable-gil)
ARG PYTHON_VERSION="v3.14.6"
RUN cd /opt && \
git clone https://github.com/python/cpython && \
cd cpython/ && \
git checkout "${PYTHON_VERSION}" && \
./configure \
--prefix="/usr" \
--enable-ipv6 \
--enable-shared \
--disable-gil \
-q && \
make -s "-j$(nproc)" && \
make install

RUN python3 -m pip install --upgrade pip setuptools wheel

# Install ElectrumX
#ARG ELECTRUMX_VERSION=1.20.0
ARG ELECTRUMX_VERSION=b8f6e227f251fe5cba96b940ffaa094439636417
RUN python3 -m pip install \
"e_x[rocksdb] @ git+https://github.com/spesmilo/electrumx.git@${ELECTRUMX_VERSION}"


ENV SERVICES="tcp://:50001"
ENV COIN=Bitcoin
ENV DB_DIRECTORY=/var/lib/electrumx
ENV DAEMON_URL="http://username:password@hostname:port/"
ENV ALLOW_ROOT=true
ENV DB_ENGINE=rocksdb
ENV CACHE_MB=2000


VOLUME /var/lib/electrumx

RUN mkdir -p "$DB_DIRECTORY"

CMD ["electrumx_server"]