First commit Docker image.

Add build/clean/monitor targets.
This commit is contained in:
Laur Ivan 2022-03-31 20:26:14 +02:00
parent a608c5d474
commit d8a53227bc
3 changed files with 40 additions and 1 deletions

19
Dockerfile Normal file
View 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"]

View File

@ -1,2 +1,19 @@
# 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
```

View File

@ -4,7 +4,10 @@
"description": "KNX event monitor an logger",
"main": "lib/index.js",
"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": {
"type": "git",