Dockerfile
This commit is contained in:
58
Docker/Dockerfile
Normal file
58
Docker/Dockerfile
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# A container for PyBitmessage daemon
|
||||||
|
FROM ubuntu:bionic-20220401
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN apt-get install -yq --no-install-suggests --no-install-recommends \
|
||||||
|
build-essential libcap-dev libssl-dev \
|
||||||
|
python-all-dev python-msgpack python-pip python-setuptools \
|
||||||
|
git
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
RUN git clone https://github.com/Bitmessage/PyBitmessage
|
||||||
|
|
||||||
|
WORKDIR /root/PyBitmessage
|
||||||
|
|
||||||
|
# Install
|
||||||
|
RUN pip2 install jsonrpclib .
|
||||||
|
|
||||||
|
FROM ubuntu:bionic-20220401
|
||||||
|
|
||||||
|
EXPOSE 8442
|
||||||
|
|
||||||
|
ENV BITMESSAGE_API_USER=api
|
||||||
|
ENV BITMESSAGE_API_PASSWORD=changeme
|
||||||
|
ENV BITMESSAGE_SEED_PHRASE=changeme
|
||||||
|
ENV BITMESSAGE_SEED_ADDRESSES=1
|
||||||
|
|
||||||
|
ENV HOME /home/bitmessage
|
||||||
|
ENV BITMESSAGE_HOME ${HOME}
|
||||||
|
|
||||||
|
COPY --from=0 /usr/local/ /usr/local/
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -yq --no-install-suggests --no-install-recommends python-setuptools \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create a user
|
||||||
|
RUN useradd --create-home --home-dir $HOME bitmessage
|
||||||
|
|
||||||
|
WORKDIR ${HOME}
|
||||||
|
USER bitmessage
|
||||||
|
|
||||||
|
# Generate default config
|
||||||
|
RUN pybitmessage -t
|
||||||
|
|
||||||
|
# Setup environment
|
||||||
|
ENTRYPOINT sed -ie "s|\(apiinterface = \).*|\10\.0\.0\.0|g" keys.dat \
|
||||||
|
#&& sed -ie "s|\(apivariant = \).*|\1json|g" keys.dat \
|
||||||
|
&& sed -ie "s|\(apiusername = \).*|\1$BITMESSAGE_API_USER|g" keys.dat \
|
||||||
|
&& sed -ie "s|\(apipassword = \).*|\1$BITMESSAGE_API_PASSWORD|g" keys.dat \
|
||||||
|
&& exec pybitmessage -d
|
||||||
|
|
||||||
|
# Generate Deterministic address
|
||||||
|
HEALTHCHECK --retries=3 --interval=15s \
|
||||||
|
CMD python -c "import xmlrpclib; api_link='http://$BITMESSAGE_API_USER:$BITMESSAGE_API_PASSWORD@127.0.0.1:8442/'; api = xmlrpclib.ServerProxy(api_link); print api.createDeterministicAddresses('$BITMESSAGE_SEED_PHRASE'.encode('base64'),$BITMESSAGE_SEED_ADDRESSES)" || exit 1
|
||||||
|
|
||||||
52
README.md
Normal file
52
README.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# Intro
|
||||||
|
|
||||||
|
[PyBitmessage](https://bitmessage.org/) is a client of the Bitmessages P2P communication protocol used to send encrypted messages to another person or to many subscribers.
|
||||||
|
|
||||||
|
PyBitmessage client running as a daemon in docker container with XML-RPC API enabled.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
The container generates a Bitmessage Deterministic Addresses based on a `BITMESSAGE_SEED_PHRASE` variable.
|
||||||
|
|
||||||
|
Here are some example snippets to help you get started creating a container.
|
||||||
|
|
||||||
|
## docker-compose
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
pybitmessage:
|
||||||
|
image: bitdeals/pybitmessage
|
||||||
|
environment:
|
||||||
|
- BITMESSAGE_API_USER=<API username>
|
||||||
|
- BITMESSAGE_API_PASSWORD=<API password>
|
||||||
|
- BITMESSAGE_SEED_PHRASE=<passphrase>
|
||||||
|
- BITMESSAGE_SEED_ADDRESSES=<1>
|
||||||
|
ports:
|
||||||
|
- 8442:8442
|
||||||
|
```
|
||||||
|
|
||||||
|
## docker cli
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -d \
|
||||||
|
-e BITMESSAGE_API_USER=api \
|
||||||
|
-e BITMESSAGE_API_PASSWORD=changeme \
|
||||||
|
-e BITMESSAGE_SEED_PHRASE=changeme \
|
||||||
|
-e BITMESSAGE_SEED_ADDRESSES=1 \
|
||||||
|
-p 8442:8442 \
|
||||||
|
bitdeals/pybitmessage
|
||||||
|
```
|
||||||
|
|
||||||
|
# Parameters
|
||||||
|
|
||||||
|
Container images are configured using parameters passed at runtime.
|
||||||
|
|
||||||
|
|Parameter|Function|
|
||||||
|
|:--------|:-------|
|
||||||
|
|-p 8442|XML-RPC API port TCP|
|
||||||
|
|-e BITMESSAGE_API_USER=|XML-RPC API user. Default: `api`|
|
||||||
|
|-e BITMESSAGE_API_PASSWORD=|XML-RPC API password. Default: `changeme`|
|
||||||
|
|-e BITMESSAGE_SEED_PHRASE|Create Deterministic Addresses password. Default: `changeme`|
|
||||||
|
|-e BITMESSAGE_SEED_ADDRESSES|Number of Deterministic Addresses to generate. Default: `1`|
|
||||||
|
|
||||||
25
bitmessage-appimage.service
Normal file
25
bitmessage-appimage.service
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Bitmessage appimage service
|
||||||
|
Documentation=https://bitmessage.org/wiki/API_Reference
|
||||||
|
ConditionPathExists=/home/bitmessage/PyBitmessage.AppImage
|
||||||
|
After=network.target
|
||||||
|
Wants=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
ExecStart=/home/bitmessage/PyBitmessage.AppImage --daemon
|
||||||
|
WorkingDirectory=/home/bitmessage
|
||||||
|
PIDFile=/home/bitmessage/.config/PyBitmessage/singleton.lock
|
||||||
|
KillMode=process
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
#Nice=10
|
||||||
|
|
||||||
|
SyslogIdentifier=bitmessage
|
||||||
|
User=bitmessage
|
||||||
|
Group=bitmessage
|
||||||
|
PrivateTmp=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
version: '3.9'
|
||||||
|
services:
|
||||||
|
bitmessage:
|
||||||
|
image: bitdeals/pybitmessage:0.6.3.2-ubuntu
|
||||||
|
environment:
|
||||||
|
- BITMESSAGE_API_USER=bitmessage_api_user
|
||||||
|
- BITMESSAGE_API_PASSWORD=bitmessage_api_password
|
||||||
|
- BITMESSAGE_SEED_PHRASE=bitmessage_seed_phrase
|
||||||
|
ports:
|
||||||
|
- 8442:8442
|
||||||
|
|
||||||
Reference in New Issue
Block a user