Skip to content

Commit

Permalink
feat: update dockerfile to contain Across relayer bot (UMAprotocol#3879)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaree authored Apr 19, 2022
1 parent bb8cc01 commit 01e898c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
36 changes: 17 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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="<mnemonic>" \
# --env PAGERDUTY_API_KEY="<pagerduty api key>" \
# --env PAGERDUTY_SERVICE_ID="<pagerduty service id>" \
# --env PAGERDUTY_FROM_EMAIL="<from email>" \
# --env SLACK_WEBHOOK="<slack webhook>" \
# --env EMP_ADDRESS="<emp address>" \
# --env POLLING_DELAY="<update delay in ms>" \
# --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 <username>/<imagename> .
#
# To `docker run` with your locally built image, replace `umaprotocol/protocol` with <username>/<imagename>.
# 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
Expand All @@ -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"]
8 changes: 4 additions & 4 deletions scripts/runCommand.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 01e898c

Please sign in to comment.