File size: 627 Bytes
19d468d
 
 
 
 
 
 
2694bf0
 
 
 
19d468d
 
 
2694bf0
0476ff6
19d468d
2694bf0
19d468d
 
 
 
 
 
 
 
b2c7c75
 
19d468d
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
30
FROM python:3.11-slim

WORKDIR /app

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

# Create user first (before any file operations)
RUN useradd -m -u 1000 user

# Install dependencies as root
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code and set ownership in one step
COPY --chown=user:user . .

# Switch to non-root user
USER user

# Set PATH for user
ENV PATH="/home/user/.local/bin:$PATH"

# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860

# Start server
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]