Spaces:
Sleeping
Sleeping
| # Use a Python 3.9 base image | |
| FROM python:3.9-slim | |
| # Set working directory | |
| WORKDIR /code | |
| # Copy requirements file | |
| COPY ./requirements.txt /code/requirements.txt | |
| # Install dependencies | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # Create a non-root user for security | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH | |
| # Set app directory | |
| WORKDIR $HOME/app | |
| # Copy all project files | |
| COPY --chown=user . $HOME/app | |
| # Expose port 7860 (Hugging Face default) | |
| EXPOSE 7860 | |
| # Run the FastAPI app with uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |