# Use Python 3.12 slim as base image
FROM python:3.12-slim

# Set working directory
WORKDIR /app

# Copy requirements.txt and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy frontend folder and install npm dependencies and build
COPY frontend ./frontend
WORKDIR /app/frontend
RUN npm install
RUN npm run build

# Copy the rest of the app code
WORKDIR /app
COPY app ./app

# Default command to run the app
CMD ["python", "app/app.py"]
