Spaces:
Sleeping
Sleeping
| # Use python 3.9 or 3.10 | |
| FROM python:3.12 | |
| # Set the working directory | |
| WORKDIR /code | |
| # Copy the requirements file | |
| COPY ./requirements.txt /code/requirements.txt | |
| # Install dependencies (No cache to save space, though HF has 16GB) | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # Copy the rest of your code | |
| COPY . /code | |
| # Create a non-root user (Hugging Face Security Requirement) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Expose port 7860 (Hugging Face specific port) | |
| EXPOSE 7860 | |
| # Start the app on port 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |