Dockerfile

This commit is contained in:
2022-05-24 20:06:29 +05:30
parent a41422528f
commit 885ae699e8
4 changed files with 152 additions and 85 deletions

View File

@@ -1,14 +1,14 @@
# Intro
Deal Module (dm) - the BitDeals daemon that provides a special interfaces for creating and modifying user accounts and deals.
Deal Module (dm) - the Bitdeals daemon that provides a special interfaces for creating and modifying user accounts and deals.
# Running DM docker container
On first run the initialization script will create and save a new bitcoin and PGP keys and start the daemon.
On first run the initialization script will create, if empty, a new bitcoin and PGP keys and start the daemon.
`docker run -i -t --rm --mount src=bitdeals-conf,dest=/etc/dm -p 127.0.0.1:4977:4977 -p 127.0.0.1:80:80 bitdeals/dm`
`docker run -i -t --rm --mount src=bitdeals-conf,dest=/etc/dm -p 127.0.0.1:4999:4999 -p 127.0.0.1:80:80 bitdeals/apostol-dm`
Daemon settings which may specified by an environment variables are saved to the daemon config file on the Docker Volume.
Daemon settings which may specified by an environment variables are saved to the daemon config files on the Docker Volume.
To use the BitDeals API you should register an user account on a BitDeals site and get a "client_id", "client_secret" at the account dashboard.
@@ -16,49 +16,47 @@ To use the BitDeals API you should register an user account on a BitDeals site a
Here are some example snippets to help you get started creating a container.
## docker-compose [(recommended, click here for more info)](https://docs.linuxserver.io/general/docker-compose)
## docker-compose
```yaml
version: "3"
services:
bitdeals-module:
image: bitdeals/apostol-dm
container_name: bitdeals-dm
environment:
- TESTNET=1 #optional
- BITCOIN=<address> #optional
- FEE=<0.1%> #optional
- PGP_PUB=<key> #optional
- PGP_SEC=<key> #optional
- PASSWORD=<password> #optional
- ACCOUNT_URL=<http[s]://example.com> #optional
- CLIENT_ID=<id> #optional
- CLIENT_SECRET=<id> #optional
- DM_TESTNET=0
- DM_BITCOIN=<address>
- DM_FEE=<0.1%>
- DM_CLIENT_ID=<id>
- DM_CLIENT_SECRET=<id>
- DM_PGP_PASSWORD=<password>
- |
DM_PGP_SEC=
-----BEGIN PGP PRIVATE KEY BLOCK-----
<key>
-----END PGP PRIVATE KEY BLOCK-----
volumes:
- bitdeals-conf:/etc/dm
ports:
- 4977:4977
- 4999:4999
- 80:80
restart: unless-stopped
```
## docker cli [(click here for more info)](https://docs.docker.com/engine/reference/commandline/cli/)
## docker cli
```sh
docker run -d \
--name=bitdeals-dm \
-e TESTNET=1 `#optional` \
-e BITCOIN=<address> `#optional` \
-e FEE=<0.1%> `#optional` \
-e PGP_PUB=$(gpg2 --armor --export Account_URL) `#optional` \
-e PGP_SEC=$(gpg2 --armor --export-secret-key Account_URL) `#optional` \
-e PASSWORD=<pgp key password> `#optional` \
-e ACCOUNT_URL=<http[s]://example.com> `#optional` \
-e CLIENT_ID=<user-id> `#optional` \
-e CLIENT_SECRET=<secret> `#optional` \
-p 127.0.0.1:4977:4977 \
-e DM_TESTNET=0 \
-e DM_BITCOIN=<address> \
-e DM_FEE=0.1% \
-e DM_PGP_SEC="$(gpg2 --armor --export-secret-key Account_URL)" \
-e DM_PGP_PASSWORD=<pgp key password> \
-e DM_CLIENT_ID=<user-id> \
-e DM_CLIENT_SECRET=<secret> \
-p 127.0.0.1:4999:4999 \
-p 127.0.0.1:80:80 \
-v bitdeals-conf:/etc/dm \
-v ./bitdeals-conf/:/etc/dm \
bitdeals/apostol-dm
```
@@ -69,14 +67,12 @@ Container images are configured using parameters passed at runtime.
|Parameter|Function|
|:--------|:-------|
|-p 80|WebUI port TCP|
|-p 4977|Module API port TCP [(API documentation)](https://bitbucket.org/bitdeals/apostol-dm)|
|-e ACCOUNT_URL=|User site address to provide a deal service. On first run the initialization script will create and save a new PGP keys with this Account_URL in key details.|
|-e TESTNET=|Enable bitcoin testnet mode.|
|-e BITCOIN=|User account bitcoin address.|
|-e FEE=|User fee for created deals.|
|-e PGP_PUB=|Variable with ASCII armored PGP public key.|
|-e PGP_SEC=|Variable with ASCII armored PGP secret key.|
|-e PASSWORD=|User PGP key password.|
|-e CLIENT_ID=|API access credentials (get it on a BitDeals site at User dashboard).|
|-e CLIENT_SECRET=|API access credentials (get it on a BitDeals site at User dashboard).|
|-p 4999|Module API port TCP [(API documentation)](https://bitbucket.org/bitdeals/apostol-dm)|
|-e DM_TESTNET=|Enable bitcoin testnet mode. Default: `0`|
|-e DM_BITCOIN=|User account bitcoin address. If empty, the initialization script will create and save a new bitcoin key.|
|-e DM_FEE=|User fee for created deals. You MUST indicate the sign “%” for a percentage of the deal amount or FIXED value in satoshi. Default: `0.1%`|
|-e DM_PGP_SEC=|Variable with ASCII armored PGP user secret key. If empty, the initialization script will create and save a new PGP key with Account_URL in the key details.|
|-e DM_PGP_PASSWORD=|User PGP key password.|
|-e DM_CLIENT_ID=|BitDeals API access credentials (get it on a BitDeals site at User dashboard).|
|-e DM_CLIENT_SECRET=|BitDeals API access credentials (get it on a BitDeals site at User dashboard).|