File size: 768 Bytes
36c285e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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"]