acpcchatbotadmin's picture
Update Dockerfile
37113c2 verified
Raw History Blame Contribute Delete
663 Bytes
# Stage 1: Build dependencies
FROM python:3.11-slim AS builder
WORKDIR /app
COPY requirements.txt .
# Install system-wide, not --user
RUN pip install --no-cache-dir -r requirements.txt
# Stage 2: Runtime
FROM python:3.11-slim AS runtime
WORKDIR /app
# Copy system-wide site-packages from builder
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Copy application code
COPY app/ ./app/
# HF Spaces runs as UID 1000
RUN useradd -m -u 1000 user
USER user
EXPOSE 7860
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]