mirror of
https://github.com/basicswap/basicswap.git
synced 2025-01-03 09:19:26 +00:00
docker: Add script container fragment.
Example: python3 ./scripts/build_yml_files.py -c bitcoin monero dash pivx --withscript
This commit is contained in:
parent
ea8cc70696
commit
484d811fe7
5 changed files with 41 additions and 10 deletions
23
docker/production/compose-fragments/8_script.yml
Normal file
23
docker/production/compose-fragments/8_script.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
swapscript:
|
||||||
|
image: i_swapclient
|
||||||
|
build:
|
||||||
|
context: swapclient
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: swapscript
|
||||||
|
volumes:
|
||||||
|
- ${DATA_PATH}/scripts:/data
|
||||||
|
environment:
|
||||||
|
- TZ
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "5"
|
||||||
|
depends_on:
|
||||||
|
- swapclient
|
||||||
|
restart: unless-stopped
|
||||||
|
command: ["/usr/bin/python3", "basicswap/scripts/createoffers.py",
|
||||||
|
"--host", "swapclient",
|
||||||
|
"--port", "${HTML_PORT}",
|
||||||
|
"--configfile", "/data/createoffers.json",
|
||||||
|
"--statefile", "/data/createoffers_state.json"]
|
|
@ -6,9 +6,12 @@
|
||||||
container_name: swapclient
|
container_name: swapclient
|
||||||
volumes:
|
volumes:
|
||||||
- ${DATA_PATH}/swapclient:/data
|
- ${DATA_PATH}/swapclient:/data
|
||||||
|
expose:
|
||||||
|
- "${HTML_PORT}"
|
||||||
|
- "${WS_PORT}"
|
||||||
ports:
|
ports:
|
||||||
- "${HTML_PORT}" # Expose only to localhost, see .env
|
- "127.0.0.1:${HTML_PORT}:${HTML_PORT}" # Expose only to localhost
|
||||||
- "${WS_PORT}" # Expose only to localhost, see .env
|
- "127.0.0.1:${WS_PORT}:${WS_PORT}" # Expose only to localhost
|
||||||
environment:
|
environment:
|
||||||
- TZ
|
- TZ
|
||||||
logging:
|
logging:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
HTML_PORT=127.0.0.1:12700:12700
|
HTML_PORT=12700
|
||||||
WS_PORT=127.0.0.1:11700:11700
|
WS_PORT=11700
|
||||||
TZ=UTC
|
TZ=UTC
|
||||||
|
|
||||||
DATA_PATH=/var/swapdata/
|
DATA_PATH=/var/swapdata/
|
||||||
|
|
|
@ -27,6 +27,7 @@ def main():
|
||||||
parser.add_argument('-v', '--version', action='version',
|
parser.add_argument('-v', '--version', action='version',
|
||||||
version='%(prog)s {version}'.format(version=__version__))
|
version='%(prog)s {version}'.format(version=__version__))
|
||||||
parser.add_argument('-c', '--coins', nargs='+', help='<Required> Select coins', required=True)
|
parser.add_argument('-c', '--coins', nargs='+', help='<Required> Select coins', required=True)
|
||||||
|
parser.add_argument('--withscript', dest='withscript', help='Add container to run createoffers.py (default=false)', required=False, action='store_true')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
with_coins = ['particl', ]
|
with_coins = ['particl', ]
|
||||||
|
@ -73,6 +74,12 @@ def main():
|
||||||
with open(os.path.join(fragments_dir, '8_swapclient.yml'), 'rb') as fp_in:
|
with open(os.path.join(fragments_dir, '8_swapclient.yml'), 'rb') as fp_in:
|
||||||
for line in fp_in:
|
for line in fp_in:
|
||||||
fp.write(line)
|
fp.write(line)
|
||||||
|
|
||||||
|
if args.withscript:
|
||||||
|
with open(os.path.join(fragments_dir, '8_script.yml'), 'rb') as fp_in:
|
||||||
|
for line in fp_in:
|
||||||
|
fp.write(line)
|
||||||
|
|
||||||
with open(os.path.join(fragments_dir, '9_swapprepare.yml'), 'rb') as fp_in:
|
with open(os.path.join(fragments_dir, '9_swapprepare.yml'), 'rb') as fp_in:
|
||||||
for line in fp_in:
|
for line in fp_in:
|
||||||
fpp.write(line)
|
fpp.write(line)
|
||||||
|
|
|
@ -26,21 +26,19 @@ ARG BASICSWAP_URL=https://github.com/tecnovert/basicswap/archive/master.zip
|
||||||
ARG BASICSWAP_DIR=basicswap-master
|
ARG BASICSWAP_DIR=basicswap-master
|
||||||
RUN wget -O basicswap-repo.zip $BASICSWAP_URL; \
|
RUN wget -O basicswap-repo.zip $BASICSWAP_URL; \
|
||||||
unzip basicswap-repo.zip; \
|
unzip basicswap-repo.zip; \
|
||||||
cd $BASICSWAP_DIR; \
|
mv $BASICSWAP_DIR /basicswap; \
|
||||||
|
cd /basicswap; \
|
||||||
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto; \
|
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto; \
|
||||||
pip3 install .;
|
pip3 install .;
|
||||||
|
|
||||||
#COPY ./test_code basicswap-master
|
#COPY ./test_code basicswap
|
||||||
#RUN cd basicswap-master; \
|
#RUN cd basicswap; \
|
||||||
# protoc -I=basicswap --python_out=basicswap basicswap/messages.proto; \
|
# protoc -I=basicswap --python_out=basicswap basicswap/messages.proto; \
|
||||||
# pip3 install .;
|
# pip3 install .;
|
||||||
|
|
||||||
RUN groupadd -r swap_user && useradd -g swap_user -ms /bin/bash swap_user && \
|
RUN groupadd -r swap_user && useradd -g swap_user -ms /bin/bash swap_user && \
|
||||||
mkdir /data && chown swap_user -R /data
|
mkdir /data && chown swap_user -R /data
|
||||||
|
|
||||||
# Expose html port
|
|
||||||
EXPOSE 12700
|
|
||||||
|
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
|
|
||||||
COPY ./entrypoint.sh /entrypoint.sh
|
COPY ./entrypoint.sh /entrypoint.sh
|
||||||
|
|
Loading…
Reference in a new issue