FROM node:18-alpine

# Install git
RUN apk add --no-cache git

# Create app directory
WORKDIR /app

# Copy package files first for better caching
COPY package*.json ./

# Install dependencies
RUN npm install --only=production

# Copy application files
COPY git_analytics_standalone.html /app/index.html
COPY config.js /app/
COPY server.js /app/

# Create directories for volumes
RUN mkdir -p /app/data /app/config

# Expose port
EXPOSE 3000

# Start the Node.js server
CMD ["node", "server.js"]