Dockerize application
This commit is contained in:
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
data/*.db
|
||||||
|
config.json
|
||||||
|
.git
|
||||||
|
.env
|
||||||
30
Dockerfile
Normal file
30
Dockerfile
Normal file
@@ -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" ]
|
||||||
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user