Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.gitignore
/.dockerignore
/Dockerfile
/RDMMonitorConfig.example.json
/README.md
/ecosystem.config.js

.git/
static/
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### Build layer: Node.js 18 ###
FROM node:18-alpine AS build-layer
WORKDIR /app

# Install Vercel's pkg build tool
RUN npm install -g pkg

# Install dependencies
COPY package.json package-lock.json ./
RUN npm install

# Build the self-contained application
COPY RDMMonitor.js ./
RUN pkg -t node18-alpine RDMMonitor.js

### Container ###
FROM alpine
WORKDIR /app
ENV NODE_ENV=production

COPY --from=build-layer /app/RDMMonitor /app/RDMMonitor
ENTRYPOINT ["/app/RDMMonitor"]
2 changes: 1 addition & 1 deletion RDMMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const path = require('path');
const args = process.argv.splice(2);
const configPath = args.length > 0
? path.resolve(__dirname, args[0])
: './RDMMonitorConfig.json';
: path.join(process.cwd(), 'RDMMonitorConfig.json');
const config = require(configPath);
const warningImage = "https://raw.githubusercontent.com/Kneckter/RDMMonitor/master/static/warned.png";
const okImage = "https://raw.githubusercontent.com/Kneckter/RDMMonitor/master/static/ok.png";
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RDMDeviceMonitor is a simple discord bot to monitor device status for RDM.

5. Copy the example file `cp RDMMonitorConfig.example.json RDMMonitorConfig.json`.

6. Create an applicaiton and get the your bot's secret token, and application ID at:
6. Create an application and get the your bot's secret token, and application ID at:
* https://discordapp.com/developers/applications/me

7. Get your application/bot to join your server by going here:
Expand All @@ -31,6 +31,18 @@ RDMDeviceMonitor is a simple discord bot to monitor device status for RDM.

<hr />

# SETTING UP THE BOT USING DOCKER:

1. Run `git clone https://github.com/Kneckter/RDMMonitor` to copy the bot.

2. Change into the new folder `cd RDMMonitor/`.

3. Build the container `docker build -t rdm-monitor .`

4. Create the application and the configuration file according to step 6-8 from the previous section.

5. Start the Docker container: `docker run -v ./RDMMonitorConfig.json:/app/RDMMonitorConfig.json rdm-monitor`

# SETTINGS
```
token: Mandator, discord bot token, bot should have send message and manage message permissions in the designated channel
Expand Down