From 6fabb20a2c8cea21612d074792255f92536df598 Mon Sep 17 00:00:00 2001 From: Minz Date: Tue, 3 Feb 2026 10:43:55 +0100 Subject: [PATCH] Dockerize application --- .dockerignore | 6 ++++++ Dockerfile | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 10 ++++++++++ 3 files changed, 46 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e2ec279 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules +npm-debug.log +data/*.db +config.json +.git +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e30506b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# Use Node.js 20 LTS as the base image +FROM node:20-slim + +# Install dependencies needed for better-sqlite3 (if prebuilt binaries fail) +RUN apt-get update && apt-get install -y \ + python3 \ + make \ + g++ \ + && rm -rf /var/lib/apt/lists/* + +# Set the working directory +WORKDIR /usr/src/app + +# Copy package files +COPY package*.json ./ + +# Install dependencies +RUN npm install --omit=dev + +# Copy the rest of the application code +COPY . . + +# Create the data directory for the database +RUN mkdir -p data + +# The bot uses config.json. In Docker, we'll likely mount this or use env vars, +# but for now, we ensure the structure is there. + +# Command to run the bot +CMD [ "node", "main.js" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..61ce727 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + minzbot: + build: . + container_name: minzbot + restart: unless-stopped + volumes: + - ./config.json:/usr/src/app/config.json:ro + - ./data:/usr/src/app/data + environment: + - NODE_ENV=production