From 01e898c1037f34818e131371c6a502a3ad0a4776 Mon Sep 17 00:00:00 2001 From: Chris Maree Date: Tue, 19 Apr 2022 18:00:07 +0200 Subject: [PATCH] feat: update dockerfile to contain Across relayer bot (#3879) --- Dockerfile | 36 +++++++++++++++++------------------- scripts/runCommand.sh | 8 ++++---- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9dc097e752..4e206b0306 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,7 @@ -# This docker container can be pulled from umaprotocol/protocol on dockerhub. -# To get the latest image, run: docker pull umaprotocol/protocol -# This docker container is used to access all components of the UMA ecosystem -# including liquidator, disputors and monitor bots. Settings for these bots are -# defined via enviroment variables. For example to run a liquidator bot run: -# docker run --env MNEMONIC="" \ -# --env PAGERDUTY_API_KEY="" \ -# --env PAGERDUTY_SERVICE_ID="" \ -# --env PAGERDUTY_FROM_EMAIL="" \ -# --env SLACK_WEBHOOK="" \ -# --env EMP_ADDRESS="" \ -# --env POLLING_DELAY="" \ -# --env COMMAND="npx truffle exec ../liquidator/index.js --network mainnet_mnemonic" \ -# umaprotocol/protocol:latest -# -# To build the docker image locally, run the following command from the `protocol` directory: -# docker build -t / . -# -# To `docker run` with your locally built image, replace `umaprotocol/protocol` with /. +# This docker container can be pulled from umaprotocol/protocol on dockerhub. This docker container is used to access +# all components of the UMA ecosystem. The entry point into the bot is defined using a COMMAND enviroment variable +# that defines what is executed in the root of the protocol package. This container also contains other UMA packages +# that are not in the protocol repo, such as the Across v2 relayer. To access these set a command # Fix node version due to high potential for incompatibilities. FROM node:14 @@ -36,5 +21,18 @@ RUN yarn RUN yarn clean RUN yarn qbuild +# Set up additional UMA packages installed in this docker container. +# Configuer the across v2 relayer as a "across-relayer" base package. +WORKDIR /across-relayer + +# Clode the relayer code and copy it to the across-relayer directory. Remove the package directory. +RUN git clone https://github.com/across-protocol/relayer-v2.git . + +# Install depdencies. +RUN yarn && yarn build + +# Set back the working directory to the protocol directory to default to that package. +WORKDIR /protocol + # Command to run any command provided by the COMMAND env variable. ENTRYPOINT ["/bin/bash", "scripts/runCommand.sh"] diff --git a/scripts/runCommand.sh b/scripts/runCommand.sh index 8437a45b17..708a68b91e 100755 --- a/scripts/runCommand.sh +++ b/scripts/runCommand.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Simple script that simply runs a command input as an environment variable. Should be run from the core/ directory. -# Note: this is used to allow the docker image to run arbitrary commands by specifying them in the environment rather -# than the `docker run` command. -$COMMAND +# Simple script that simply runs a command input as an environment variable. This is used to allow the docker image to +# run arbitrary commands by specifying them in the environment rather than the docker run command. Optionally, specify +# UMA_PACKAGE as an ENV which lets you navigate to additional base packages installed within the container. +if [ -z ${UMA_PACKAGE+x} ]; then $COMMAND; else cd ../${UMA_PACKAGE} && $COMMAND; fi