# 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" ]
