# Use Node.js 20 Alpine for a lightweight image
FROM node:20-alpine

# Set working directory
WORKDIR /app

# Copy package files first to leverage Docker cache
COPY package.json ./

# Install all dependencies (including devDependencies for nodemon in dev mode)
# Using npm install since package-lock.json is gitignored
RUN npm install

# Copy source code
COPY . .

# Expose the MCP SSE port and monitor UI port
EXPOSE 3000 4545

# Set environment variables (can be overridden in docker-compose for dev)
ENV NODE_ENV=development
# Disable the monitor by default in Docker unless explicitly enabled, 
# but since we expose the port, let's assume the user might want it.
# However, for MCP stdio, we must ensure no stray logs go to stdout.
# The application code already handles this by using console.error for logs.

# Command to run the server
CMD ["node", "index.js"]
