Browse Source

🔨 Change Dockerfile

main
Haris Razis 4 years ago
parent
commit
061df5965a
No known key found for this signature in database GPG Key ID: 86A4D290ED03FAB4
  1. 8
      server/Dockerfile
  2. 2
      server/server.sh
  3. 5
      server/src/class/Database.ts

8
server/Dockerfile

@ -1,13 +1,15 @@
FROM node:latest FROM node:latest
WORKDIR /usr/src/app WORKDIR /usr/src/anchiale
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install && npm install typescript -g
COPY . . COPY . .
EXPOSE 3000 EXPOSE 3000
ENTRYPOINT npm run start RUN tsc
CMD ["node", "./build/index.js"]

2
server/server.sh

@ -1,2 +1,2 @@
docker build -t xrazis/server . docker build -t xrazis/server .
docker run -d -p 3000:3000 xrazis/server docker run -d -p 8087:3000 xrazis/server

5
server/src/class/Database.ts

@ -24,14 +24,13 @@ export class Database {
process.env.DB_ORG!, process.env.DB_ORG!,
process.env.DB_BUCKET! process.env.DB_BUCKET!
); );
this.writeApi.useDefaultTags({ host: 'local' });
this.queryApi = this.client.getQueryApi(process.env.DB_ORG!); this.queryApi = this.client.getQueryApi(process.env.DB_ORG!);
} }
write(uuid: string, value: number, pointName: string) { write(uuid: string, measurement: number, pointName: string) {
const point = new Point(pointName) const point = new Point(pointName)
.tag('client', uuid) .tag('client', uuid)
.floatField('value', value); .floatField('value', measurement);
this.writeApi.writePoint(point); this.writeApi.writePoint(point);
this.writeApi.flush(); this.writeApi.flush();
} }

Loading…
Cancel
Save