Created a Dockerfile & docker-compose so theres no need to run in separate terminals (#111)

* docker file & docker-compose

* Readme & spelling corretions

* undoing formatOnSave changes

* more changes to readme
This commit is contained in:
Marko
2019-02-21 16:41:24 +01:00
committed by Maciej Hirsz
parent 71778e9450
commit dfaabac0df
4 changed files with 53 additions and 3 deletions
+16
View File
@@ -0,0 +1,16 @@
FROM node:alpine
WORKDIR /app
RUN apk update && apk add python g++ make openssh git bash pdftk
RUN export PYTHONPATH=${PYTHONPATH}:/usr/lib/python2.7
COPY ./package.json yarn.lock ./
RUN yarn
COPY . .
# Frontend is exposing 3000
# Backend is exposing 8080
# No need for expose, if using docker-compose & docker run -p 3000:3000
+10
View File
@@ -22,4 +22,14 @@ yarn start:frontend
./target/debug/polkadot --dev --telemetry-url ws://localhost:1024
```
### Run via Docker
To run via docker make sure that you have Docker Desktop
- If you dont you can download for you OS here [Docker Desktop](https://www.docker.com/products/docker-desktop)
```
docker-compose up --build -d
```
- -d stands for detach, if you would like to see logs i recommend using [Kitmatic](https://kitematic.com/) or dont use the -d
- --build will build the images and rebuild, but this is not required everytime
- If you want to makes UI changes, there is no need to rebuild the image as the files are being copied in via volumes.
Now navigate to localhost:3000 in your browser to view the app.
+25
View File
@@ -0,0 +1,25 @@
version: "3"
services:
telemetry-frontend:
build:
dockerfile: Dockerfile
context: ./
# Copy in changes to the ui, so no need to rebulld the images.
volumes:
- /app/node_modules
- ./packages:/app/packages
command: yarn start:frontend
ports:
- 3000:3000
telemetry-backend:
build:
dockerfile: Dockerfile
context: ./
command: yarn start:backend
environment:
- TELEMETRY_SERVER=1024
- FEED_SERVER=8080
ports:
- 8080:8080
- 1024:1024
+2 -3
View File
@@ -3,8 +3,8 @@ import Node from './Node';
import Feed from './Feed';
import Aggregator from './Aggregator';
const WS_PORT_TELEMETRY_SERVER = 1024;
const WS_PORT_FEED_SERVER = 8080;
const WS_PORT_TELEMETRY_SERVER = process.env.TELEMETRY_SERVER || 1024;
const WS_PORT_FEED_SERVER = process.env.FEED_SERVER || 8080;
const aggregator = new Aggregator();
@@ -47,4 +47,3 @@ logClients();
telemetryFeed.on('connection', (socket: WebSocket) => {
aggregator.addFeed(new Feed(socket));
});