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
					
				
							
								
								
									
										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
 | 
			
		||||
        volumes:
 | 
			
		||||
            - ${DATA_PATH}/swapclient:/data
 | 
			
		||||
        expose:
 | 
			
		||||
            - "${HTML_PORT}"
 | 
			
		||||
            - "${WS_PORT}"
 | 
			
		||||
        ports:
 | 
			
		||||
            - "${HTML_PORT}"  # Expose only to localhost, see .env
 | 
			
		||||
            - "${WS_PORT}"    # Expose only to localhost, see .env
 | 
			
		||||
            - "127.0.0.1:${HTML_PORT}:${HTML_PORT}"  # Expose only to localhost
 | 
			
		||||
            - "127.0.0.1:${WS_PORT}:${WS_PORT}"      # Expose only to localhost
 | 
			
		||||
        environment:
 | 
			
		||||
            - TZ
 | 
			
		||||
        logging:
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
HTML_PORT=127.0.0.1:12700:12700
 | 
			
		||||
WS_PORT=127.0.0.1:11700:11700
 | 
			
		||||
HTML_PORT=12700
 | 
			
		||||
WS_PORT=11700
 | 
			
		||||
TZ=UTC
 | 
			
		||||
 | 
			
		||||
DATA_PATH=/var/swapdata/
 | 
			
		||||
 | 
			
		||||
@ -27,6 +27,7 @@ def main():
 | 
			
		||||
    parser.add_argument('-v', '--version', action='version',
 | 
			
		||||
                        version='%(prog)s {version}'.format(version=__version__))
 | 
			
		||||
    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()
 | 
			
		||||
 | 
			
		||||
    with_coins = ['particl', ]
 | 
			
		||||
@ -73,6 +74,12 @@ def main():
 | 
			
		||||
        with open(os.path.join(fragments_dir, '8_swapclient.yml'), 'rb') as fp_in:
 | 
			
		||||
            for line in fp_in:
 | 
			
		||||
                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:
 | 
			
		||||
            for line in fp_in:
 | 
			
		||||
                fpp.write(line)
 | 
			
		||||
 | 
			
		||||
@ -26,21 +26,19 @@ ARG BASICSWAP_URL=https://github.com/tecnovert/basicswap/archive/master.zip
 | 
			
		||||
ARG BASICSWAP_DIR=basicswap-master
 | 
			
		||||
RUN wget -O basicswap-repo.zip $BASICSWAP_URL; \
 | 
			
		||||
    unzip basicswap-repo.zip; \
 | 
			
		||||
    cd $BASICSWAP_DIR; \
 | 
			
		||||
    mv $BASICSWAP_DIR /basicswap; \
 | 
			
		||||
    cd /basicswap; \
 | 
			
		||||
    protoc -I=basicswap --python_out=basicswap basicswap/messages.proto; \
 | 
			
		||||
    pip3 install .;
 | 
			
		||||
 | 
			
		||||
#COPY ./test_code basicswap-master
 | 
			
		||||
#RUN cd basicswap-master; \
 | 
			
		||||
#COPY ./test_code basicswap
 | 
			
		||||
#RUN cd basicswap; \
 | 
			
		||||
#    protoc -I=basicswap --python_out=basicswap basicswap/messages.proto; \
 | 
			
		||||
#    pip3 install .;
 | 
			
		||||
 | 
			
		||||
RUN groupadd -r swap_user && useradd -g swap_user -ms /bin/bash swap_user && \
 | 
			
		||||
    mkdir /data && chown swap_user -R /data
 | 
			
		||||
 | 
			
		||||
# Expose html port
 | 
			
		||||
EXPOSE 12700
 | 
			
		||||
 | 
			
		||||
VOLUME /data
 | 
			
		||||
 | 
			
		||||
COPY ./entrypoint.sh /entrypoint.sh
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user