| # Use a Python base image suitable for machine learning | |
| FROM python:3.10-slim | |
| # Install system dependencies needed for libraries like TensorFlow | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set the working directory | |
| WORKDIR /app | |
| # Define and install Python dependencies | |
| # We use an explicit list here instead of a separate requirements.txt for robustness | |
| RUN pip install --no-cache-dir \ | |
| tensorflow==2.15.0 \ | |
| scikit-learn \ | |
| numpy \ | |
| pandas \ | |
| joblib \ | |
| gradio | |
| # Copy all the application files (app.py, model, scaler, etc.) | |
| COPY . . | |
| # Command to run the Gradio app | |
| CMD python app.py |