diff --git a/Dockerfile b/Dockerfile index 81b95ef..f524c60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,46 @@ -ARG VERSION=1.16.0 +# Use Debian Trixie slim with Python 3.13 +FROM python:3.13-slim-trixie -FROM python:3.7-alpine3.11 LABEL maintainer="Luke Childs " -ARG VERSION +ARG VERSION=1.18.0 +# Install dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + build-essential \ + python3-dev \ + libleveldb-dev \ + libssl-dev \ + openssl \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +# Copy helper scripts (init, etc.) COPY ./bin /usr/local/bin +RUN chmod a+x /usr/local/bin/* -RUN chmod a+x /usr/local/bin/* && \ - apk add --no-cache git build-base openssl && \ - apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.11/main leveldb-dev && \ - apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing rocksdb-dev && \ - pip install aiohttp pylru plyvel websockets python-rocksdb uvloop && \ - git clone -b $VERSION https://github.com/spesmilo/electrumx.git && \ - cd electrumx && \ - python setup.py install && \ - apk del git build-base && \ - rm -rf /tmp/* +# Clone ElectrumX source and install +RUN git clone --depth 1 --branch ${VERSION} https://github.com/spesmilo/electrumx.git /electrumx \ + && pip install --no-cache-dir uvloop plyvel \ + && pip install --no-cache-dir /electrumx \ + && rm -rf /electrumx +# ElectrumX config VOLUME ["/data"] -ENV HOME /data -ENV ALLOW_ROOT 1 -ENV EVENT_LOOP_POLICY uvloop -ENV DB_DIRECTORY /data +ENV HOME=/data +ENV ALLOW_ROOT=1 +ENV EVENT_LOOP_POLICY=uvloop +ENV DB_DIRECTORY=/data ENV SERVICES=tcp://:50001,ssl://:50002,wss://:50004,rpc://0.0.0.0:8000 -ENV SSL_CERTFILE ${DB_DIRECTORY}/electrumx.crt -ENV SSL_KEYFILE ${DB_DIRECTORY}/electrumx.key -ENV HOST "" +ENV SSL_CERTFILE=${DB_DIRECTORY}/electrumx.crt +ENV SSL_KEYFILE=${DB_DIRECTORY}/electrumx.key +ENV HOST="" + WORKDIR /data +# Ports: TCP, SSL, WS, RPC EXPOSE 50001 50002 50004 8000 CMD ["init"] + diff --git a/README.md b/README.md index dad7d5c..2a81031 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ An easily configurable Docker image for running an Electrum server. docker run \ -v /home/username/electrumx:/data \ -e DAEMON_URL=http://user:pass@host:port \ - -e COIN=BitcoinSegwit \ + -e COIN=Bitcoin \ -p 50002:50002 \ lukechilds/electrumx ``` @@ -48,9 +48,9 @@ You can also run a specific version of ElectrumX if you want. docker run \ -v /home/username/electrumx:/data \ -e DAEMON_URL=http://user:pass@host:port \ - -e COIN=BitcoinSegwit \ + -e COIN=Bitcoin \ -p 50002:50002 \ - lukechilds/electrumx:v1.8.7 + lukechilds/electrumx:v1.18.0 ``` ## License diff --git a/bin/init b/bin/init index de2157e..48e26da 100644 --- a/bin/init +++ b/bin/init @@ -1,7 +1,10 @@ #!/bin/sh if [ ! -e "${SSL_CERTFILE}" ] || [ ! -e "${SSL_KEYFILE}" ]; then - openssl req -newkey rsa:2048 -sha256 -nodes -x509 -days 365 -subj "/O=ElectrumX" -keyout "${SSL_KEYFILE}" -out "${SSL_CERTFILE}" + openssl req -newkey rsa:2048 -sha256 -nodes -x509 -days 36500 \ + -subj "/O=ElectrumX" \ + -keyout "${SSL_KEYFILE}" \ + -out "${SSL_CERTFILE}" fi -exec /electrumx/electrumx_server +exec electrumx_server