| # Use Python 3.10 | |
| FROM python:3.10 | |
| # Set working directory to /code | |
| WORKDIR /code | |
| # Copy the requirements file | |
| COPY requirements.txt . | |
| # Install dependencies | |
| # We add --no-cache-dir to keep the image small | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all your backend files (app.py, inference.py, etc.) | |
| COPY . . | |
| # Create the models directory (just in case) and set permissions | |
| RUN mkdir -p /code/models && chmod 777 /code/models | |
| # Expose the correct port | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["python", "app.py"] |