# HuggingFace Spaces Docker Container for EdgeHomes Embedding API FROM python:3.10 # Create user with ID 1000 (required by HF Spaces) RUN useradd -m -u 1000 user # Set working directory WORKDIR /app # Copy requirements and install dependencies with proper ownership COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy application code with proper ownership COPY --chown=user ./app.py app.py # Switch to non-root user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Expose port 7860 (HF Spaces standard) EXPOSE 7860 # Start FastAPI app on port 7860, bound to all interfaces CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]