Skip to content

Commit

Permalink
feat(docker): add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed Feb 13, 2021
1 parent f1228a7 commit 2b92e07
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.github/
node_modules/
.env
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#############
# Should be the specific version of node:alpine3.
FROM node:14.15.5-buster@sha256:28b64286eb60f8b14112c9d3900a826743796b0efe04344c8a25371d56ac6b86 AS development

WORKDIR /srv/app/

COPY ./package.json ./package-lock.json ./

RUN npm install

COPY ./ ./


########################
# Should be the specific version of node:alpine3.
FROM node:14.15.5-buster@sha256:28b64286eb60f8b14112c9d3900a826743796b0efe04344c8a25371d56ac6b86 AS build

ENV NODE_ENV=production

WORKDIR /srv/app/

COPY --from=development /srv/app/ ./

# Discard devDependencies.
RUN yarn install


#######################
# Should be the specific version of node:alpine3.
FROM node:14.15.5-alpine3.13@sha256:17dc61b31b2a12a1390b5a4e2e69b0d0886a0d77647f88c5a33787ac457fa83e AS production

ENV NODE_ENV=production

WORKDIR /srv/app/

COPY --from=build /srv/app/ ./
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ $EDITOR .env
**Never check in your `.env` file!**
It contains your most private information.

**This project can be used as a Docker container!** Use the `docker run` commands below, after building the container:
`docker build -t node-binance-trader .`

**To start the server** to save pair data, define strategies and emit trading signals:
```
npm run start
// or
docker run --rm -it -v "$PWD/.env:/srv/app/.env" -p 4000:4000 node-binance-trader npm run start
```

**To start the auto trader** to monitor strategies and signals received from the server or the NBT Hub:
Expand All @@ -60,11 +65,15 @@ npm run start

```
npm run trader
// or
docker run --rm -it -v "$PWD/.env:/srv/app/.env" node-binance-trader npm run trader
```

**To backtest** strategies using the data recorded by the server:
```
npm run bt
// or
docker run --rm -it -v "$PWD/.env:/srv/app/.env" node-binance-trader npm run bt
```

# Web Socket API specifications 📡
Expand Down

0 comments on commit 2b92e07

Please sign in to comment.