# Use the official Python 3.9 image
FROM python:3.9-slim

# Set environment variables
ENV FLASK_APP=app.py
ENV FLASK_ENV=development

# Set the working directory
WORKDIR /app

# Copy all files to the container
COPY . .

# Change permissions of the root directory and the data.db file
RUN chmod 777 data.db

# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860

# Run the Flask app
CMD ["python", "app.py"]