🐳 Add docker support

This commit is contained in:
2023-06-23 20:43:21 +02:00
parent 6bd5c35eb2
commit 2a2852f5dd
4 changed files with 21 additions and 2 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
node_modules/
.env
data/

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
node_modules/
.env
data.json
data/

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

View File

@ -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);
});