File size: 654 Bytes
bf45da8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
FROM python:3.10-slim

# Env
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV HOME=/app
ENV PORT=7860

WORKDIR /app

# Create non-root user
RUN adduser --disabled-password --gecos '' appuser && \

    chown -R appuser:appuser /app

# Install Python deps first (better layer caching)
COPY requirements.txt .
RUN pip install --upgrade pip && \

    pip install --no-cache-dir -r requirements.txt

# Copy app code
COPY . .
RUN chown -R appuser:appuser /app

# Switch to non-root
USER appuser

# Expose the Gradio/FastAPI port
EXPOSE 7860

# HF Spaces will run this entrypoint; local dev works too
CMD ["python", "app.py"]