# 1. Use the specific Python version matching your local environment FROM python:3.10.16-slim # 2. Set the working directory inside the container WORKDIR /code # 3. Copy requirements first (for better caching) COPY ./requirements.txt /code/requirements.txt # 4. Install dependencies # We use --no-cache-dir to keep the image small RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # 5. Copy the rest of your application code COPY . /code # 6. CRITICAL: Give write permissions to the backend folder # This allows SQLite to create lock files and update the DB RUN chmod -R 777 /code/backend # 7. Start the app on port 7860 (Hugging Face default) CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]