Spaces:
Runtime error
Runtime error
# Use the official Python image | |
FROM python:3.9-slim | |
# Set environment variables | |
ENV PYTHONUNBUFFERED=1 \ | |
PYTHONDONTWRITEBYTECODE=1 | |
# Set Hugging Face cache directory to a writable location inside the container | |
ENV HF_HOME="/app/huggingface_cache" | |
# Ensure the cache directory exists and is writable | |
RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME | |
# Set working directory inside the container | |
WORKDIR /app | |
# Copy and install dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the entire project (including main.py in root) | |
COPY . /app | |
# Expose the FastAPI port | |
EXPOSE 8000 | |
# Run FastAPI (use `main` instead of `app.main`) | |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] | |