Initial Commit
Some checks failed
Build / build (push) Failing after 1m15s

This commit is contained in:
2024-09-15 18:41:07 -04:00
commit da297b4f6a
4 changed files with 120 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
name: Build
run-name: Build Docker Image
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-20.04
env:
VERSION: 1.16.0
steps:
- name: Install docker
uses: papodaca/install-docker-action@main
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout
uses: actions/checkout@v4
- name: Login into Registry
uses: docker/login-action@v3
with:
registry: https://git.prettyhefty.com
username: ${{ gitea.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Prepare Meta
id: prepare
run: |
PLATFORM="linux/amd64"
REPO=${{ gitea.repository }}
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=docker_platform::${PLATFORM}
echo ::set-output name=repository::${REPO,,}
echo ::set-output name=version::${VERSION}
- name: Build Docker image
uses: docker/build-push-action@v6
with:
platforms: ${{ steps.prepare.outputs.docker_platform }}
push: true
tags: git.prettyhefty.com/${{ steps.prepare.outputs.repository }}:${{ steps.prepare.outputs.version }}

34
Dockerfile Normal file
View File

@@ -0,0 +1,34 @@
ARG VERSION=1.16.0
FROM python:3.7-alpine3.11
LABEL maintainer="Bill Ballou <bill@bballou.com>"
ARG VERSION
COPY ./bin /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/*
VOLUME ["/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 ""
WORKDIR /data
EXPOSE 50001 50002 50004 8000
CMD ["init"]

31
README.md Normal file
View File

@@ -0,0 +1,31 @@
# electrumx-docker
Docker image for running an Electrum server.
## Usage
```
docker run \
-v /home/username/electrumx:/data \
-e DAEMON_URL=http://user:pass@host:port \
-e COIN=BitcoinSegwit \
-p 50002:50002 \
lukechilds/electrumx
```
If there's an SSL certificate/key (`electrumx.crt`/`electrumx.key`) in the `/data` volume it'll be used. If not, one will be generated for you.
View all ElectrumX environment variables here: https://github.com/spesmilo/electrumx/blob/master/docs/environment.rst
### TCP Port
By default only the SSL port is exposed. Expose the unencrypted TCP port with `-p 50001:50001`.
### WebSocket Port
Expose the WebSocket port with `-p 50004:50004`.
### RPC Port
To access RPC from your host machine, expose port 8000: `-p 127.0.0.1:8000:8000`.

7
bin/init Normal file
View File

@@ -0,0 +1,7 @@
#!/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}"
fi
exec /electrumx/electrumx_server