Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim-buster | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy the requirements file | |
| COPY requirements.txt . | |
| # Install the dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the application code | |
| COPY . . | |
| # Create the database directory if it doesn't exist | |
| RUN mkdir -p app/ml_models | |
| # Set the environment variables | |
| ENV DATABASE_URL="sqlite:///./app/ml_models/financial_advisor.db" | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |
| # WARNING: Using SQLite on Hugging Face Spaces will result in data loss on every restart. | |
| # Consider using a persistent database like PostgreSQL for production deployments. | |
| # OPTIONAL: To implement data backup, you can add the following instructions: | |
| # 1. Save the database file to a persistent storage (e.g., Hugging Face Hub or cloud storage) before the Space restarts. | |
| # 2. Restore the database file on startup. | |