🐳 Add docker support
This commit is contained in:
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
.env
|
||||
data/
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
node_modules/
|
||||
.env
|
||||
data.json
|
||||
data/
|
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM node:lts-alpine
|
||||
|
||||
WORKDIR /app
|
||||
COPY package*.json /app/
|
||||
RUN npm ci
|
||||
|
||||
COPY ./ /app/
|
||||
|
||||
VOLUME [ "/app/data" ]
|
||||
CMD ["node", "index.js"]
|
8
index.js
8
index.js
@ -1,10 +1,11 @@
|
||||
import * as sdk from "matrix-js-sdk";
|
||||
import fetch from "node-fetch";
|
||||
import process from "process";
|
||||
import "dotenv/config";
|
||||
import { JsonDB, Config } from "node-json-db";
|
||||
import { TimetableClient } from "./timetable.js";
|
||||
|
||||
const db = new JsonDB(new Config("data", true, true, "/"));
|
||||
const db = new JsonDB(new Config("data/data", true, true, "/"));
|
||||
const timetable = new TimetableClient(
|
||||
process.env.TIMETABLE_ENDPOINT,
|
||||
process.env.TIMETABLE_TOKEN
|
||||
@ -296,3 +297,8 @@ async function handleReaction(event, room) {
|
||||
}
|
||||
|
||||
client.startClient(0);
|
||||
|
||||
process.on("SIGINT", () => {
|
||||
console.info("Interrupted");
|
||||
process.exit(0);
|
||||
});
|
||||
|
Reference in New Issue
Block a user