Spaces:
Sleeping
Sleeping
File size: 938 Bytes
33525a5 | 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 32 33 34 35 36 37 | # ββ Build stage βββββββββββββββββββββββββββββββββββββββββββββββ
FROM python:3.11-slim AS builder
WORKDIR /build
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
# ββ Runtime stage βββββββββββββββββββββββββββββββββββββββββββββ
FROM python:3.11-slim
# HF Spaces runs as a non-root user; create one to match
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /install /usr/local
# Copy source code
COPY environment/ ./environment/
COPY app.py .
# Make inference.py available at root (required by spec)
COPY inference.py .
# HF Spaces exposes port 7860
EXPOSE 7860
USER appuser
ENV PORT=7860
ENV PYTHONUNBUFFERED=1
CMD ["python", "app.py"]
|