First commit Docker image.
Add build/clean/monitor targets.
This commit is contained in:
parent
a608c5d474
commit
d8a53227bc
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Use NodeJS server for the app.
|
||||||
|
FROM node:14
|
||||||
|
|
||||||
|
# Copy files as a non-root user. The `node` user is built in the Node image.
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
RUN chown node:node ./
|
||||||
|
USER node
|
||||||
|
|
||||||
|
# Defaults to production, docker-compose overrides this to development on build and run.
|
||||||
|
ARG NODE_ENV=production
|
||||||
|
ENV NODE_ENV $NODE_ENV
|
||||||
|
|
||||||
|
# Install dependencies first, as they change less often than code.
|
||||||
|
COPY .npmrc package.json package-lock.json* ./
|
||||||
|
RUN npm ci && npm cache clean --force
|
||||||
|
COPY ./dist ./dist
|
||||||
|
|
||||||
|
# Execute NodeJS (not NPM script) to handle SIGTERM and SIGINT signals.
|
||||||
|
CMD ["node", "./dist/index.js"]
|
17
README.md
17
README.md
@ -1,2 +1,19 @@
|
|||||||
# knx-monitor
|
# knx-monitor
|
||||||
|
|
||||||
|
# Build
|
||||||
|
|
||||||
|
Build and run locally:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm ci
|
||||||
|
npm run monitor # to run the monitoring program
|
||||||
|
```
|
||||||
|
|
||||||
|
Docker:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker login -u laur -p <pass here> 10.0.0.30:15001
|
||||||
|
docker build -t laur-knx-monitor:0.0.1 .
|
||||||
|
docker push 10.0.0.30:15001/laur-knx-monitor:0.0.1
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -4,7 +4,10 @@
|
|||||||
"description": "KNX event monitor an logger",
|
"description": "KNX event monitor an logger",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"build": "tsc --build",
|
||||||
|
"clean": "tsc --build --clean",
|
||||||
|
"lint": "eslint --fix \"**/*.ts\"",
|
||||||
|
"monitor": "npx ./dist/index.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
Loading…
Reference in New Issue
Block a user