Dockerized app
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
node_modules
|
||||
.env
|
||||
data/messages.db
|
||||
.git
|
||||
.gitignore
|
||||
.mimocode
|
||||
README.md
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
.dockerignore
|
||||
@@ -0,0 +1,18 @@
|
||||
# Discord Bot Token
|
||||
# Get this from https://discord.com/developers/applications
|
||||
DISCORD_TOKEN=
|
||||
|
||||
# Discord Channel IDs to monitor (comma-separated)
|
||||
DISCORD_CHANNEL_IDS=
|
||||
|
||||
# Channel name mapping (channel_id=name, comma-separated)
|
||||
CHANNEL_NAMES=
|
||||
|
||||
# Server port (optional, defaults to 8000)
|
||||
PORT=8000
|
||||
|
||||
# Base URL for RSS feed links (optional)
|
||||
BASE_URL=localhost
|
||||
|
||||
# Fetch interval in milliseconds (optional, defaults to 5 minutes)
|
||||
FETCH_INTERVAL_MS=300000
|
||||
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
.env
|
||||
data/messages.db
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
FROM node:18-slim AS base
|
||||
WORKDIR /app
|
||||
|
||||
# Install dumb-init for proper signal handling
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends dumb-init && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy dependency manifests first (layer cache)
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci --omit=dev && npm cache clean --force
|
||||
|
||||
# Copy application code
|
||||
COPY src/ ./src/
|
||||
|
||||
# Create data directory for SQLite
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
USER node
|
||||
|
||||
ENTRYPOINT ["dumb-init", "--"]
|
||||
CMD ["node", "src/index.js"]
|
||||
@@ -0,0 +1,18 @@
|
||||
services:
|
||||
rss-bot:
|
||||
build: .
|
||||
container_name: discord-rss-bot
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "8000:8000"
|
||||
volumes:
|
||||
- rss-data:/app/data
|
||||
healthcheck:
|
||||
test: ["CMD", "node", "-e", "fetch('http://localhost:8000/health').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
volumes:
|
||||
rss-data:
|
||||
Reference in New Issue
Block a user