Simplify docker config.

This commit is contained in:
tecnovert 2020-12-02 23:19:10 +02:00
parent 8c9105ce01
commit 3bbb483a0a
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
8 changed files with 52 additions and 34 deletions

View file

@ -1 +0,0 @@
docker

View file

@ -1,14 +1,11 @@
FROM ubuntu:20.04
ARG WITH_COINS
ARG WITHOUT_COINS
ENV LANG=C.UTF-8 \
DEBIAN_FRONTEND=noninteractive \
DATADIRS="/coindata"
RUN apt-get update; \
apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config;
apt-get install -y wget python3-pip gnupg unzip protobuf-compiler automake libtool pkg-config gosu;
RUN wget -O coincurve-anonswap.zip https://github.com/tecnovert/coincurve/archive/anonswap.zip && \
unzip coincurve-anonswap.zip && \
@ -21,18 +18,15 @@ RUN cd basicswap-master; \
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto; \
pip3 install .;
# Download binaries, these will be part of the docker image
RUN basicswap-prepare -datadir=/opt -preparebinonly ${WITH_COINS} ${WITHOUT_COINS}
RUN useradd -ms /bin/bash user && \
mkdir /coindata && chown user -R /coindata
USER user
WORKDIR /home/user
RUN useradd -ms /bin/bash swap_user && \
mkdir /coindata && chown swap_user -R /coindata
# Expose html port
EXPOSE 12700
VOLUME /coindata
ENTRYPOINT ["basicswap-run", "-datadir=/coindata/basicswap"]
COPY ./docker/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["basicswap-run", "-datadir=/coindata/basicswap"]

View file

@ -8,24 +8,22 @@
"""
Atomic Swap Client - Proof of Concept
sudo pip install python-gnupg
"""
import sys
import os
import sys
import json
import hashlib
import mmap
import stat
import gnupg
import hashlib
import tarfile
import zipfile
import stat
from urllib.request import urlretrieve
import urllib.parse
import logging
import platform
import urllib.parse
from urllib.request import urlretrieve
import gnupg
import basicswap.config as cfg
from basicswap.rpc import (
@ -571,8 +569,8 @@ def main():
'network_key': '7sW2UEcHXvuqEjkpE5mD584zRaQYs6WXYohue4jLFZPTvMSxwvgs',
'network_pubkey': '035758c4a22d7dd59165db02a56156e790224361eb3191f02197addcb3bde903d2',
'chainclients': withchainclients,
'auto_reply_delay_min': 5, # Min delay before sending a response message
'auto_reply_delay_max': 50, # Max delay before sending a response message
'min_delay_event': 5, # Min delay in seconds before reacting to an event
'max_delay_event': 50, # Max delay in seconds before reacting to an event
'check_progress_seconds': 60,
'check_watched_seconds': 60,
'check_expired_seconds': 60

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019 tecnovert
# Copyright (c) 2019-2020 tecnovert
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
@ -10,14 +10,15 @@ Atomic Swap Client - Proof of Concept
"""
import sys
import os
import time
import sys
import json
import traceback
import time
import signal
import subprocess
import logging
import traceback
import subprocess
import basicswap.config as cfg
from basicswap import __version__

View file

@ -1,7 +1,29 @@
# Docker Setup
## Build the images
```
$ docker-compose build
```
## Prepare the binaries, coin dirs and settings
```
$ docker run -t --name swap_prepare -v /tmp/coindata:/coindata i_swapclient basicswap-prepare --datadir=/coindata --withcoins=monero --withoutcoins=litecoin
```
Record the mnemonic from the output of the above command.
Remove swap_prepare container (and logs):
```
$ docker rm swap_prepare
```
# Running on windows 10
Work in progress - doesn't work reliably.
Running on windows 10
Install the latest docker toolbox from:
https://github.com/docker/toolbox/releases

View file

@ -1,2 +1,2 @@
HTML_PORT=127.0.0.1:12700:12700
COINDATA_PATH=./coindata
COINDATA_PATH=/var/data/basicswap

View file

@ -2,12 +2,10 @@ version: '3'
services:
swapclient:
image: i_swapclient
stop_grace_period: 5m
build:
context: ../
args:
- WITH_COINS=--withcoins=monero
- WITHOUT_COINS=--withoutcoins=litecoin
volumes:
- ${COINDATA_PATH}:/coindata
ports:

6
docker/entrypoint.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
set -e
chown -R swap_user "$DATADIRS"
exec gosu swap_user "$@"