Spaces:
Runtime error
Runtime error
# Use official Python 3.10 slim image for a smaller footprint | |
FROM python:3.10-slim | |
# Set environment variable for Hugging Face cache | |
ENV TRANSFORMERS_CACHE=/app/cache | |
ENV HF_HOME=/app/cache | |
# Set working directory | |
WORKDIR /app | |
# Copy requirements file | |
COPY requirements.txt . | |
# Install system dependencies and Python packages | |
# Note: libgomp1 is required for PyTorch | |
RUN apt-get update && apt-get install -y \ | |
gcc \ | |
libgomp1 \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& pip install --no-cache-dir -r requirements.txt | |
# Copy application code | |
COPY app.py . | |
# Create cache and logs directories with write permissions | |
RUN mkdir -p /app/cache /app/logs \ | |
&& chmod -R 777 /app/cache /app/logs | |
# Expose port for FastAPI | |
EXPOSE 8000 | |
# Run Uvicorn server | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] |