diff --git a/pricenode/docker/Dockerfile b/pricenode/docker/Dockerfile index cc195cd63b5..f28d57cb31d 100644 --- a/pricenode/docker/Dockerfile +++ b/pricenode/docker/Dockerfile @@ -1,26 +1,37 @@ +# first the builder builds the executables ### -# The directory of the Dockerfile should contain your 'hostname' and 'private_key' files. -# In the docker-compose.yml file you can pass the ONION_ADDRESS referenced below. -### - -# pull base image -FROM openjdk:8-jdk +FROM gradle:jdk11 as builder +ARG BISQ_URL +ARG BISQ_BRANCH +RUN git clone $BISQ_URL +WORKDIR /home/gradle/bisq/ +# git sometimes complains about this, can be bogus because we're not going to commit things +RUN git config --global user.email "you@example.com" +RUN git config --global user.name "Your Name" +RUN git fetch origin $BISQ_BRANCH && git checkout $BISQ_BRANCH +RUN git rev-parse --verify HEAD > git_head.txt +RUN ./gradlew :pricenode:installDist -x test < /dev/null +RUN chmod +x ./pricenode/build/app/bin/bisq-pricenode +# then the actual image is created, without gradle, using just the artifacts from the builder +### +FROM openjdk:10 +EXPOSE 8000 RUN apt-get update && apt-get install -y --no-install-recommends \ vim \ tor \ fakeroot \ sudo \ openjfx && rm -rf /var/lib/apt/lists/* - -RUN git clone https://github.com/bisq-network/pricenode.git -WORKDIR /pricenode/ -RUN ./gradlew assemble - +# copy the seednode artifact from the builder to the final container +RUN mkdir /home/bisq +COPY --from=builder /home/gradle/bisq/pricenode/build/app/bin/bisq-pricenode /home/bisq/bin/bisq-pricenode +COPY --from=builder /home/gradle/bisq/pricenode/build/app/lib /home/bisq/lib/ +COPY --from=builder /home/gradle/bisq/git_head.txt /home/bisq/git_head.txt +WORKDIR /home/bisq/ COPY loop.sh start_node.sh start_tor.sh ./ COPY hostname private_key /var/lib/tor/ COPY torrc /etc/tor/ RUN chmod +x *.sh && chown debian-tor:debian-tor /etc/tor/torrc /var/lib/tor/hostname /var/lib/tor/private_key - CMD ./start_tor.sh && ./start_node.sh -#CMD tail -f /dev/null + diff --git a/pricenode/docker/README.md b/pricenode/docker/README.md index 5f7a4e6d11f..973c3681ea9 100644 --- a/pricenode/docker/README.md +++ b/pricenode/docker/README.md @@ -1,43 +1,26 @@ -Needed information to start a pricenode -== +# Needed information to start a pricenode -Copy to this directory: --- +## Copy to this directory -* a tor `hostname` file, containing your onion address -* a tor `private_key` file, containing the private key for your tor hidden service +- a tor `hostname` file, containing your onion address +- a tor `private_key` file, containing the private key for your tor hidden service -Edit docker-compose.yml: --- +## Edit docker-compose.yml -* fill in your public and private api keys (needs a btcaverage developer subscription) +- fill in your public and private api keys (needs a bitcoinaverage.com developer subscription at the moment) +- optionally: update BISQ_URL and BISQ_BRANCH -Needed software to start a pricenode -== +## Needed software to start a pricenode -* docker -* docker-compose +- docker +- docker-compose -How to start -== +## How to start `docker-compose up -d` - -How to monitor -== +## How to monitor See if it's running: `docker ps` Check the logs: `docker-compose logs` - - -Notes when using CoreOs -== - -Using CoreOs as host OS is entirely optional! - -* the cloudconfig.yml file is a configuration file for starting a coreos machine -from scratch. -* when installing a Coreos server, docker-compose needs to be additionally installed next to the -already provided docker installation diff --git a/pricenode/docker/docker-compose.yml b/pricenode/docker/docker-compose.yml index 9ecdb846884..0b9bfe772d8 100644 --- a/pricenode/docker/docker-compose.yml +++ b/pricenode/docker/docker-compose.yml @@ -4,9 +4,13 @@ version: '3' services: pricenode: + container_name: pricenode restart: unless-stopped build: context: . + args: + - BISQ_URL=https://github.com/bisq-network/bisq.git + - BISQ_BRANCH=master image: bisq:pricenode ports: - 80:80 diff --git a/pricenode/docker/loop.sh b/pricenode/docker/loop.sh old mode 100644 new mode 100755 index 1720f6eed90..c48fb7c8561 --- a/pricenode/docker/loop.sh +++ b/pricenode/docker/loop.sh @@ -2,7 +2,7 @@ while true do echo `date` "(Re)-starting node" -BITCOIN_AVG_PUBKEY=$BTCAVERAGE_PUBKEY BITCOIN_AVG_PRIVKEY=$BTCAVERAGE_PRIVKEY java -jar ./build/libs/bisq-pricenode.jar 2 2 +BITCOIN_AVG_PUBKEY=$BTCAVERAGE_PUBKEY BITCOIN_AVG_PRIVKEY=$BTCAVERAGE_PRIVKEY ./bin/bisq-pricenode 2 2 echo `date` "node terminated unexpectedly!!" sleep 3 done