Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
update Dockerfile to use pre-compiled binnary v1.11.0 (closes #713)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsaraf committed Jul 2, 2021
1 parent 6b30fa2 commit 9615bc9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Your use of Kelp is governed by the Apache 2.0 open-source license. Please note
* [Getting Started](#getting-started)
* [How To Get Kelp](#how-to-get-kelp)
* [Download Kelp Binary](#download-kelp-binary)
* [Run With Docker](#run-with-docker)
* [Compile from Source](#compile-from-source)
* [Running Kelp](#running-kelp)
* [Using CCXT](#using-ccxt)
Expand Down Expand Up @@ -108,6 +109,15 @@ To run the bot in simulation mode, try this command:

./kelp trade -c sample_trader.cfg -s buysell -f sample_buysell.cfg --sim

### Run With Docker

This docker image (`nikhilsaraf/kelp:latest`) points to the latest pre-compiled version of the kelp binary v1.11.0, which can be run like this:

`docker run nikhilsaraf/kelp:latest version`
`docker run nikhilsaraf/kelp:latest trade -c sample_trader.cfg -s buysell -f sample_buysell.cfg --sim`
`docker run nikhilsaraf/kelp:latest exchanges`
`docker run nikhilsaraf/kelp:latest strategies`

### Compile from Source

_Note for Windows Users: You should use a [Bash Shell][bash] to follow the steps below. This will give you a UNIX environment in which to run your commands and will enable the `./scripts/build.sh` bash script to work correctly._
Expand Down
45 changes: 21 additions & 24 deletions ops/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
FROM golang:1.12.7
FROM ubuntu:20.04

LABEL maintainer="Nikhil Saraf <Github: @nikhilsaraf>"

# install yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt update
RUN apt -y install yarn
# add dependencies: curl, unzip
RUN apt-get update && apt-get install -y curl unzip

# set working dir
WORKDIR /go/src/github.com/stellar/kelp
RUN pwd
# fetch ccxt-rest
RUN mkdir -p /root/.kelp/ccxt
RUN curl -L https://github.com/stellar/kelp/releases/download/ccxt-rest_v0.0.4/ccxt-rest_linux-x64.zip -o /root/.kelp/ccxt/ccxt-rest_linux-x64.zip
RUN unzip /root/.kelp/ccxt/ccxt-rest_linux-x64.zip -d /root/.kelp/ccxt

# install glide
RUN curl -s https://glide.sh/get | sh

# install kelp
ENV GOPATH /go
RUN git clone https://github.com/stellar/kelp.git .
RUN git fetch --tags
RUN glide install
RUN ./scripts/build.sh
# fetch kelp archive
RUN curl -L https://github.com/stellar/kelp/releases/download/v1.11.0/kelp-v1.11.0-linux-amd64.tar -o kelp-archive.tar
# extract
RUN tar xvf kelp-archive.tar
# set working directory
WORKDIR kelp-v1.11.0

# set ulimit
RUN ulimit -n 10000

# start ccxt-rest when container is started
CMD nohup /root/.kelp/ccxt/ccxt-rest_linux-x64/ccxt-rest > ~/ccxt-rest.log &

# use command line arguments from invocation of docker run against this ENTRYPOINT command - https://stackoverflow.com/a/40312311/1484710
ENTRYPOINT ["./bin/kelp"]
ENTRYPOINT ["./kelp"]
# default arguments are empty
CMD [""]

# sample command to run this container as a daemon process:
# docker run -v `pwd`/ops:/go/src/github.com/stellar/kelp/bin/ops -d -p 8011:8011 <image> server -p 8011 --ccxt-rest-url=http://host.docker.internal:3000
# this assumes that you are running ccxt on port 3000 outside this kelp docker container
# the three port numbers (8011 in the example above) must be the same and must be specified
# the first part of the -v argument is the directory where you want to save the kelp configs and kelp logs from the bots created in this container
# sample command to run this container:
# docker run nikhilsaraf/kelp:latest trade -c sample_trader.cfg -s buysell -f sample_buysell.cfg --sim

0 comments on commit 9615bc9

Please sign in to comment.