Docker: Dockerfile + .dockerignore + push to dockerhub: dergeorg/ntopngglobe

This commit is contained in:
Georg Reisinger 2022-02-01 23:35:16 +01:00
parent 6a6b9844a9
commit d5c26d6198
6 changed files with 105 additions and 43 deletions

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM node:16
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm ci --only=production
# Bundle app source
COPY . .
EXPOSE 3100
EXPOSE 8999
CMD [ "npm", "start" ]

View File

@ -17,6 +17,17 @@ npm install
npm start
```
### Docker
#### Run with config file
```sh
docker run -p 3100:3100 -p 8999:8999 --name ntopngglobe -v /PATH/TO/CONF/FOLDER:/usr/src/app/public/conf -d dergeorg/ntopngglobe
```
#### Run without config file (default config)
```sh
docker run -p 3100:3100 -p 8999:8999 --name ntopngglobe -d dergeorg/ntopngglobe
```
### Usage
> :notebook: **Open in browser**: ```http://<ADRESS>:3100```

View File

@ -3,47 +3,7 @@ var data = {
arc: []
}
var settings = {
location: {
home: {
lat: 48.1,
lng: 16.3
},
precision: 0
},
colors: {
loc: {
default: "green",
dualsender: "orange"
},
arc: {
default: ["green", "red"],
dualsender: ["orange", "orange"]
}
},
sizes: {
loc: {
default: 0.1
},
arc: {
default: 1.1
},
globe: {
arcDashLength: 0.4,
arcAltitudeAutoScale: 0.4,
arcDashGap: 0.1,
arcDashInitialGap: 0.1,
arcDashAnimateTime: 7000,
arcStroke: 0.5,
labelSize: 0,
labelDotRadius: 0.4,
labelResolution: 2
}
},
timer:{
del: 30
}
}
var settings = require('../public/conf/settings.json')
var geoip = require('fast-geoip');

29
package-lock.json generated
View File

@ -17,7 +17,8 @@
"jade": "~1.11.0",
"morgan": "~1.9.1",
"node-cron": "^3.0.0",
"uuid": "^8.3.2"
"uuid": "^8.3.2",
"ws": "^8.4.2"
}
},
"node_modules/accepts": {
@ -1002,6 +1003,26 @@
"node": ">=0.4.0"
}
},
"node_modules/ws": {
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz",
"integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/yargs": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz",
@ -1774,6 +1795,12 @@
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz",
"integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8="
},
"ws": {
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz",
"integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==",
"requires": {}
},
"yargs": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz",

View File

@ -15,6 +15,7 @@
"jade": "~1.11.0",
"morgan": "~1.9.1",
"node-cron": "^3.0.0",
"uuid": "^8.3.2"
"uuid": "^8.3.2",
"ws": "^8.4.2"
}
}

47
public/conf/settings.json Normal file
View File

@ -0,0 +1,47 @@
{
"location": {
"home": {
"lat": 48.1,
"lng": 16.3
},
"precision": 0
},
"colors": {
"loc": {
"default": "green",
"dualsender": "orange"
},
"arc": {
"default": [
"green",
"red"
],
"dualsender": [
"orange",
"orange"
]
}
},
"sizes": {
"loc": {
"default": 0.1
},
"arc": {
"default": 1.1
},
"globe": {
"arcDashLength": 0.4,
"arcAltitudeAutoScale": 0.4,
"arcDashGap": 0.1,
"arcDashInitialGap": 0.1,
"arcDashAnimateTime": 7000,
"arcStroke": 0.5,
"labelSize": 0,
"labelDotRadius": 0.4,
"labelResolution": 2
}
},
"timer": {
"del": 30
}
}