researcher / Dockerfile
sccastillo's picture
Fix Hugging Face Spaces deployment: enhance app.py, optimize Dockerfile, add main.py alternative
113ef3e
FROM python:3.10.9-slim
# Set working directory
WORKDIR /app
# Copy requirements first (for better caching)
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the application code
COPY . .
# Create a non-root user for security
RUN adduser --disabled-password --gecos '' appuser && chown -R appuser:appuser /app
USER appuser
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Set environment variables
ENV PYTHONPATH=/app
ENV PORT=7860
# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]