From 49b42b83b944a4d8b377396df7143e6adb9bc2d8 Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Sun, 2 Apr 2023 16:40:49 +0300 Subject: [PATCH] done with dockerizing --- .dockerignore | 4 +++- Dockerfile | 2 +- src/index.ts | 11 ++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.dockerignore b/.dockerignore index 5171c54..92a116f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,4 @@ node_modules -npm-debug.log \ No newline at end of file +npm-debug.log +src +tmp \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8d2ae21..7d0eb91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:latest +FROM node:16 # Create app directory WORKDIR /usr/src/app diff --git a/src/index.ts b/src/index.ts index 39ee401..b9f4ca3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -40,17 +40,18 @@ class App { const app = new App(); console.log("Declaring Cron Job every day at 10:00") -const cron = "0 10 * * *" // every day at 10:00 - const job = new CronJob( - "* * * * *", + "0 10 * * *", // every day at 10:00, async () => { - console.log("START") + console.log("Staring a new job") const outputFileLocation = 'public/maccabi-haifa-fc.ics'; + console.log("Getting games from Haifa") const games = await app.gameSource.getGamesFromHaifa(); + console.log("Generating ICS file") const icsEvents = app.ics.generateIcsOutputFromGames(games); + console.log("Writing ICS file to " + outputFileLocation) fs.writeFileSync(outputFileLocation, icsEvents); - console.log("END") + console.log("Done") }, null, true,